Commit 632246cb authored by Romain Courteaud's avatar Romain Courteaud

slapos_erp5:

* update one more test
* test_virtual_master_slave_on_same_tree_without_accounting_scenario
* test_virtual_master_on_remote_tree_without_accounting_scenario
* test_virtual_master_slave_instance_on_remote_tree_without_accounting_scenario
* test: really disable accounting
parent 9ae93bdd
......@@ -578,7 +578,7 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
def test_virtual_master_slave_without_accounting_scenario(self):
_, _, _, sale_person = self.bootstrapVirtualMasterTest()
_, _, _, sale_person = self.bootstrapVirtualMasterTest(is_virtual_master_accountable=False)
self.web_site = self.portal.web_site_module.slapos_master_panel
......@@ -715,14 +715,19 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
self.login()
# Ensure no unexpected object has been created
# 3 (can reduce to 2) assignment, 2 instance tree, 1 compute node, 1 software installation
# 6 allocation supply/line/cell
# 2 compute/instance node
# 1 credential request
# 2 instance tree
# 9 open sale order / line
# 2 assignment
# 4 simulation movement
# 2 sale trade condition
# 1 software installation
# 2 software instance
# 2 credential request
# 2 software product
# 6 allocation supply/line/cell
# 1 instance node
related_object_list = project.Base_getRelatedObjectList(**{'category.category_strict_membership': 1})
assert len(related_object_list) == 20, [x.getRelativeUrl() for x in related_object_list]
# 4 subscription request
self.assertRelatedObjectCount(project, 37)
self.stepcheckERP5Consistency()
......@@ -732,18 +737,9 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
def test_virtual_master_slave_on_same_tree_without_accounting_scenario(self):
# create a default project
project = self.addProject()
self.web_site = self.portal.web_site_module.slapos_master_panel
_, _, _, sale_person = self.bootstrapVirtualMasterTest(is_virtual_master_accountable=False)
preference = self.portal.portal_preferences.slapos_default_system_preference
preference.edit(
preferred_subscription_assignment_category_list=[
'function/customer',
'role/client',
'destination_project/%s' % project.getRelativeUrl()
]
)
self.web_site = self.portal.web_site_module.slapos_master_panel
# some preparation
self.logout()
......@@ -756,7 +752,25 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
owner_person = self.portal.portal_catalog.getResultValue(
portal_type="ERP5 Login",
reference=owner_reference).getParentValue()
self.tic()
self.logout()
self.login(sale_person.getUserId())
# create a default project
project_relative_url = self.addProject(person=owner_person)
self.logout()
self.login()
project = self.portal.restrictedTraverse(project_relative_url)
preference = self.portal.portal_preferences.slapos_default_system_preference
preference.edit(
preferred_subscription_assignment_category_list=[
'function/customer',
'role/client',
'destination_project/%s' % project.getRelativeUrl()
]
)
# first slapos administrator assignment can only be created by
# the erp5 manager
self.addProjectProductionManagerAssignment(owner_person, project)
......@@ -822,13 +836,17 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
self.login()
# Ensure no unexpected object has been created
# 3 (can reduce to 2) assignment, 1 instance tree, 1 compute node, 1 software installation
# 3 allocation supply/line/cell
# 1 compute node
# 1 credential request
# 1 instance tree
# 6 open sale order / line
# 2 assignments
# 1 software installation
# 2 software instance
# 2 credential request
# 1 software product
# 3 allocation supply/line/cell
related_object_list = project.Base_getRelatedObjectList(**{'category.category_strict_membership': 1})
assert len(related_object_list) == 14, [x.getRelativeUrl() for x in related_object_list]
# 3 subscription request
self.assertRelatedObjectCount(project, 23)
self.stepcheckERP5Consistency()
......@@ -838,20 +856,9 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
def test_virtual_master_on_remote_tree_without_accounting_scenario(self):
self.web_site = self.portal.web_site_module.slapos_master_panel
preference = self.portal.portal_preferences.slapos_default_system_preference
_, _, _, sale_person = self.bootstrapVirtualMasterTest(is_virtual_master_accountable=False)
####################################
# Create a remote project
####################################
remote_project = self.addProject()
preference.edit(
preferred_subscription_assignment_category_list=[
'function/customer',
'role/client',
'destination_project/%s' % remote_project.getRelativeUrl()
]
)
self.web_site = self.portal.web_site_module.slapos_master_panel
# some preparation
self.logout()
......@@ -864,7 +871,25 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
remote_owner_person = self.portal.portal_catalog.getResultValue(
portal_type="ERP5 Login",
reference=remote_owner_reference).getParentValue()
self.tic()
self.logout()
self.login(sale_person.getUserId())
# create a default project
remote_project_relative_url = self.addProject(person=remote_owner_person)
self.logout()
self.login()
remote_project = self.portal.restrictedTraverse(remote_project_relative_url)
preference = self.portal.portal_preferences.slapos_default_system_preference
preference.edit(
preferred_subscription_assignment_category_list=[
'function/customer',
'role/client',
'destination_project/%s' % remote_project.getRelativeUrl()
]
)
# first slapos administrator assignment can only be created by
# the erp5 manager
self.addProjectProductionManagerAssignment(remote_owner_person, remote_project)
......@@ -911,7 +936,15 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
####################################
# Create a local project
####################################
project = self.addProject()
self.logout()
self.login(sale_person.getUserId())
# create a default project
project_relative_url = self.addProject(person=remote_public_person)
self.logout()
self.login()
project = self.portal.restrictedTraverse(project_relative_url)
preference.edit(
preferred_subscription_assignment_category_list=[
'function/customer',
......@@ -919,14 +952,14 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
'destination_project/%s' % project.getRelativeUrl()
]
)
owner_person = remote_public_person
# first slapos administrator assignment can only be created by
# the erp5 manager
self.addProjectProductionManagerAssignment(owner_person, project)
self.addProjectProductionManagerAssignment(remote_public_person, project)
self.tic()
owner_person = remote_public_person
self.logout()
# hooray, now it is time to create compute_nodes
self.login(owner_person.getUserId())
......@@ -965,7 +998,7 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
# XXX Do this for every scenario tests
self.logout()
for _ in range(3):
for _ in range(5):
self.stepCallAlarmList()
self.tic()
# now instantiate it on compute_node and set some nice connection dict
......@@ -1014,23 +1047,35 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
self.login()
# Ensure no unexpected object has been created
# 3 (can reduce to 2) assignment, 1 remote node, 1 software installation
# 1 compute node
# 1 instance tree, 1 software instance
# 2 credential request
# 1 software product
# 3 allocation supply/line/cell
related_object_list = remote_project.Base_getRelatedObjectList(**{'category.category_strict_membership': 1})
assert len(related_object_list) == 14, [x.getRelativeUrl() for x in related_object_list]
# 2 compute/remote node
# 1 credential request
# 1 instance tree
# 6 open sale order / line
# 2 assignment
# 3 simulation movements
# 3 sale packing list / line
# 2 sale trade condition
# 1 software installation
# 1 software instance
# 1 software product
# 3 subscription requests
self.assertRelatedObjectCount(remote_project, 29)
# Ensure no unexpected object has been created
# 2 (can reduce to 2) assignment, 1 remote node
# 1 instance tree, 1 software instance
# 3 allocation supply/line/cell
# 1 compute node
# 1 credential request
# 1 instance tree
# 4 open sale order / line
# 2 assignment
# 2 simulation movements
# 2 sale packing list / line
# 2 sale trade condition
# 1 software instance
# 1 software product
# 3 allocation supply/line/cell
related_object_list = project.Base_getRelatedObjectList(**{'category.category_strict_membership': 1})
assert len(related_object_list) == 10, [x.getRelativeUrl() for x in related_object_list]
# 2 subscription requests
self.assertRelatedObjectCount(project, 22)
self.stepcheckERP5Consistency()
......@@ -1041,20 +1086,9 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
def test_virtual_master_slave_instance_on_remote_tree_without_accounting_scenario(self):
self.web_site = self.portal.web_site_module.slapos_master_panel
preference = self.portal.portal_preferences.slapos_default_system_preference
_, _, _, sale_person = self.bootstrapVirtualMasterTest(is_virtual_master_accountable=False)
####################################
# Create a remote project
####################################
remote_project = self.addProject()
preference.edit(
preferred_subscription_assignment_category_list=[
'function/customer',
'role/client',
'destination_project/%s' % remote_project.getRelativeUrl()
]
)
self.web_site = self.portal.web_site_module.slapos_master_panel
# some preparation
self.logout()
......@@ -1067,7 +1101,25 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
remote_owner_person = self.portal.portal_catalog.getResultValue(
portal_type="ERP5 Login",
reference=remote_owner_reference).getParentValue()
self.tic()
self.logout()
self.login(sale_person.getUserId())
# create a default project
remote_project_relative_url = self.addProject(person=remote_owner_person)
self.logout()
self.login()
remote_project = self.portal.restrictedTraverse(remote_project_relative_url)
preference = self.portal.portal_preferences.slapos_default_system_preference
preference.edit(
preferred_subscription_assignment_category_list=[
'function/customer',
'role/client',
'destination_project/%s' % remote_project.getRelativeUrl()
]
)
# first slapos administrator assignment can only be created by
# the erp5 manager
self.addProjectProductionManagerAssignment(remote_owner_person, remote_project)
......@@ -1132,7 +1184,15 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
####################################
# Create a local project
####################################
project = self.addProject()
self.logout()
self.login(sale_person.getUserId())
# create a default project
project_relative_url = self.addProject(person=remote_public_person)
self.logout()
self.login()
project = self.portal.restrictedTraverse(project_relative_url)
preference.edit(
preferred_subscription_assignment_category_list=[
'function/customer',
......@@ -1140,14 +1200,14 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
'destination_project/%s' % project.getRelativeUrl()
]
)
owner_person = remote_public_person
# first slapos administrator assignment can only be created by
# the erp5 manager
self.addProjectProductionManagerAssignment(owner_person, project)
self.addProjectProductionManagerAssignment(remote_public_person, project)
self.tic()
owner_person = remote_public_person
self.logout()
# hooray, now it is time to create compute_nodes
self.login(owner_person.getUserId())
......@@ -1157,9 +1217,6 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
# and install some software on them
public_server_software = remote_server_software
remote_compute_node.requestSoftwareRelease(software_release_url=public_server_software,
state='available')
#software_product, release_variation, type_variation = self.addSoftwareProduct(
public_instance_type = remote_instance_type
software_product, software_release, software_type = self.addSoftwareProduct(
......@@ -1190,7 +1247,7 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
# XXX Do this for every scenario tests
self.logout()
for _ in range(3):
for _ in range(5):
self.stepCallAlarmList()
self.tic()
# now instantiate it on compute_node and set some nice connection dict
......@@ -1240,24 +1297,35 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
self.login()
# Ensure no unexpected object has been created
# 3 (can reduce to 2) assignment, 1 remote node, 1 software installation
# 1 compute node
# 1 instance node
# 2 instance tree, 1 software instance, 1 slave instance
# 2 credential request
# 1 software product
# 6 allocation supply/line/cell
related_object_list = remote_project.Base_getRelatedObjectList(**{'category.category_strict_membership': 1})
assert len(related_object_list) == 20, [x.getRelativeUrl() for x in related_object_list]
# 3 compute/remote/instance node
# 1 credential request
# 2 instance tree
# 9 open sale order / line
# 2 assignment
# 4 simulation movements
# 4 sale packing list / line
# 2 sale trade condition
# 1 software installation
# 2 software instance
# 1 software product
# 4 subscription requests
self.assertRelatedObjectCount(remote_project, 41)
# Ensure no unexpected object has been created
# 2 (can reduce to 2) assignment, 1 remote node, 1 software installation
# 1 instance tree, 1 slave instance
# 3 allocation supply/line/cell
# 1 compute node
# 1 credential request
# 1 instance tree
# 4 open sale order / line
# 2 assignment
# 2 simulation movements
# 2 sale packing list / line
# 2 sale trade condition
# 1 software instance
# 1 software product
# 3 allocation supply/line/cell
related_object_list = project.Base_getRelatedObjectList(**{'category.category_strict_membership': 1})
assert len(related_object_list) == 11, [x.getRelativeUrl() for x in related_object_list]
# 2 subscription requests
self.assertRelatedObjectCount(project, 22)
self.stepcheckERP5Consistency()
......
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