Commit af3f0d92 authored by Romain Courteaud's avatar Romain Courteaud

slapos_erp5: drop friend/personal in new scenario test

parent 461fa9c1
...@@ -25,12 +25,19 @@ import re ...@@ -25,12 +25,19 @@ import re
class TestSlapOSDefaultScenario(DefaultScenarioMixin): class TestSlapOSDefaultScenario(DefaultScenarioMixin):
def test_new_default_scenatio(self): def addSlapOSAdministratorAssignment(self, person):
person.newContent(
portal_type='Assignment',
# XXX should be project/function instead
group='company'
).open()
def test_new_default_scenario(self):
# some preparation # some preparation
self.logout() self.logout()
self.web_site = self.portal.web_site_module.hostingjs self.web_site = self.portal.web_site_module.hostingjs
# lets join as owner, which will own few compute_nodes # lets join as slapos administrator, which will own few compute_nodes
owner_reference = 'owner-%s' % self.generateNewId() owner_reference = 'owner-%s' % self.generateNewId()
self.joinSlapOS(self.web_site, owner_reference) self.joinSlapOS(self.web_site, owner_reference)
...@@ -39,6 +46,11 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin): ...@@ -39,6 +46,11 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
portal_type="ERP5 Login", portal_type="ERP5 Login",
reference=owner_reference).getParentValue() reference=owner_reference).getParentValue()
# first slapos administrator assignment can only be created by
# the erp5 manager
self.addSlapOSAdministratorAssignment(owner_person)
self.tic()
# hooray, now it is time to create compute_nodes # hooray, now it is time to create compute_nodes
self.login(owner_person.getUserId()) self.login(owner_person.getUserId())
...@@ -48,37 +60,13 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin): ...@@ -48,37 +60,13 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
portal_type='Compute Node', reference=public_server_id) portal_type='Compute Node', reference=public_server_id)
self.setAccessToMemcached(public_server) self.setAccessToMemcached(public_server)
self.assertNotEqual(None, public_server) self.assertNotEqual(None, public_server)
self.setServerOpenPublic(public_server)
personal_server_title = 'Personal Server for %s' % owner_reference
personal_server_id = self.requestComputeNode(personal_server_title)
personal_server = self.portal.portal_catalog.getResultValue(
portal_type='Compute Node', reference=personal_server_id)
self.assertNotEqual(None, personal_server)
self.setServerOpenPersonal(personal_server)
friend_server_title = 'Friend Server for %s' % owner_reference
friend_server_id = self.requestComputeNode(friend_server_title)
friend_server = self.portal.portal_catalog.getResultValue(
portal_type='Compute Node', reference=friend_server_id)
self.assertNotEqual(None, friend_server)
self.setServerOpenFriend(friend_server)
# and install some software on them # and install some software on them
public_server_software = self.generateNewSoftwareReleaseUrl() public_server_software = self.generateNewSoftwareReleaseUrl()
self.supplySoftware(public_server, public_server_software) self.supplySoftware(public_server, public_server_software)
personal_server_software = self.generateNewSoftwareReleaseUrl()
self.supplySoftware(personal_server, personal_server_software)
friend_server_software = self.generateNewSoftwareReleaseUrl()
self.supplySoftware(friend_server, friend_server_software)
# format the compute_nodes # format the compute_nodes
self.formatComputeNode(public_server) self.formatComputeNode(public_server)
self.formatComputeNode(personal_server)
self.formatComputeNode(friend_server)
# join as the another visitor and request software instance on public # join as the another visitor and request software instance on public
# compute_node # compute_node
...@@ -98,34 +86,6 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin): ...@@ -98,34 +86,6 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
public_server_software, public_instance_type, public_server_software, public_instance_type,
public_server) public_server)
# join as owner friend and request a software instance on compute_node
# configured by owner
self.logout()
friend_reference = 'friend-%s' % self.generateNewId()
self.joinSlapOS(self.web_site, friend_reference)
self.login()
friend_person = self.portal.portal_catalog.getResultValue(
portal_type='ERP5 Login', reference=friend_reference).getParentValue()
friend_email = friend_person.getDefaultEmailText()
# allow friend to alloce on friendly compute_node
self.login(owner_person.getUserId())
self.setServerOpenFriend(friend_server, [friend_email])
friend_instance_title = 'Friend title %s' % self.generateNewId()
friend_instance_type = 'friend_type'
self.checkInstanceAllocation(friend_person.getUserId(), friend_reference,
friend_instance_title, friend_server_software, friend_instance_type,
friend_server)
# check that friend is able to request slave instance matching the
# public's compute_node software instance
friend_slave_instance_title = 'Friend slave title %s' % self.\
generateNewId()
self.checkSlaveInstanceAllocation(friend_person.getUserId(),
friend_reference, friend_slave_instance_title, public_server_software,
public_instance_type, public_server)
# turn public guy to a friend and check that he can allocate slave # turn public guy to a friend and check that he can allocate slave
# instance on instance provided by friend # instance on instance provided by friend
...@@ -133,50 +93,23 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin): ...@@ -133,50 +93,23 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
self.login() self.login()
public_person = self.portal.portal_catalog.getResultValue( public_person = self.portal.portal_catalog.getResultValue(
portal_type='ERP5 Login', reference=public_reference).getParentValue() portal_type='ERP5 Login', reference=public_reference).getParentValue()
public_email = public_person.getDefaultEmailText()
self.login(owner_person.getUserId()) self.login(owner_person.getUserId())
self.setServerOpenFriend(friend_server, [friend_email, public_email])
public_slave_instance_title = 'Public slave title %s' % self\
.generateNewId()
self.checkSlaveInstanceAllocation(public_person.getUserId(),
public_reference, public_slave_instance_title, friend_server_software,
friend_instance_type, friend_server)
# now deallocate the slaves
self.checkSlaveInstanceUnallocation(public_person.getUserId(),
public_reference, public_slave_instance_title, friend_server_software,
friend_instance_type, friend_server)
self.checkSlaveInstanceUnallocation(friend_person.getUserId(),
friend_reference, friend_slave_instance_title, public_server_software,
public_instance_type, public_server)
# and the instances # and the instances
self.checkInstanceUnallocation(public_person.getUserId(), self.checkInstanceUnallocation(public_person.getUserId(),
public_reference, public_instance_title, public_reference, public_instance_title,
public_server_software, public_instance_type, public_server) public_server_software, public_instance_type, public_server)
self.checkInstanceUnallocation(friend_person.getUserId(),
friend_reference, friend_instance_title,
friend_server_software, friend_instance_type, friend_server)
# and uninstall some software on them # and uninstall some software on them
self.logout() self.logout()
self.login(owner_person.getUserId()) self.login(owner_person.getUserId())
self.supplySoftware(public_server, public_server_software, self.supplySoftware(public_server, public_server_software,
state='destroyed') state='destroyed')
self.supplySoftware(personal_server, personal_server_software,
state='destroyed')
self.supplySoftware(friend_server, friend_server_software,
state='destroyed')
self.logout() self.logout()
# Uninstall from compute_node # Uninstall from compute_node
self.login() self.login()
self.simulateSlapgridSR(public_server) self.simulateSlapgridSR(public_server)
self.simulateSlapgridSR(personal_server)
self.simulateSlapgridSR(friend_server)
# check the Open Sale Order coverage # check the Open Sale Order coverage
self.stepCallSlaposRequestUpdateInstanceTreeOpenSaleOrderAlarm() self.stepCallSlaposRequestUpdateInstanceTreeOpenSaleOrderAlarm()
...@@ -184,8 +117,6 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin): ...@@ -184,8 +117,6 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
self.login() self.login()
self.assertOpenSaleOrderCoverage(owner_reference)
self.assertOpenSaleOrderCoverage(friend_reference)
self.assertOpenSaleOrderCoverage(public_reference) self.assertOpenSaleOrderCoverage(public_reference)
# generate simulation for open order # generate simulation for open order
...@@ -273,18 +204,11 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin): ...@@ -273,18 +204,11 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
self.tic() self.tic()
# check final document state # check final document state
for person_reference in (owner_reference, friend_reference, for person_reference in (owner_reference, ):
public_reference):
person = self.portal.portal_catalog.getResultValue( person = self.portal.portal_catalog.getResultValue(
portal_type='ERP5 Login', reference=person_reference).getParentValue() portal_type='ERP5 Login', reference=person_reference).getParentValue()
self.assertPersonDocumentCoverage(person) self.assertPersonDocumentCoverage(person)
self.login(public_person.getUserId())
self.usePayzenManually(self.web_site, public_person.getUserId())
self.login(friend_person.getUserId())
self.usePayzenManually(self.web_site, friend_person.getUserId())
def test_default_scenario(self): def test_default_scenario(self):
# some preparation # some preparation
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment