Commit 3303bb75 authored by Romain Courteaud's avatar Romain Courteaud

slapos_erp5:

* ensure that subscription_assignment_category_list is set on the system preference
* test: set subscription_assignment_category_list on the system preference
parent 062864a3
......@@ -23,6 +23,16 @@ if context.getId() != "slapos_default_system_preference":
if fixit:
context.disable(comment="Disabled by PreferenceTool_checkSystemPreferenceConsistency")
subscription_assignment_category_list = context.portal_preferences.getPreferredSubscriptionAssignmentCategoryList()
if 'function/customer' not in subscription_assignment_category_list:
error_list.append(
'The System Preference subscription assignment should have function/customer')
if 'role/client' not in subscription_assignment_category_list:
error_list.append(
'The System Preference subscription assignment should have role/client')
if not [x for x in subscription_assignment_category_list if x.startswith('destination_project/project_module/')]:
error_list.append(
'The System Preference subscription assignment should have a destination_project')
preference_method_list = [
"getPreferredHateoasUrl",
......
......@@ -52,8 +52,14 @@ class TestSlapOSVirtualMasterScenario(DefaultScenarioMixin):
# create a default project
project = self.addProject()
self.web_site = self.portal.web_site_module.slapos_master_panel
self.web_site.edit(
configuration_default_project_relative_url=project.getRelativeUrl()
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()
]
)
# some preparation
......@@ -101,7 +107,6 @@ class TestSlapOSVirtualMasterScenario(DefaultScenarioMixin):
public_person = self.portal.portal_catalog.getResultValue(
portal_type="ERP5 Login",
reference=public_reference).getParentValue()
self.addProjectCustomerAssignment(public_person, project)
public_instance_title = 'Public title %s' % self.generateNewId()
public_instance_type = 'public type'
......@@ -141,11 +146,11 @@ class TestSlapOSVirtualMasterScenario(DefaultScenarioMixin):
self.login()
# Ensure no unexpected object has been created
# 2 assignment, 1 instance tree, 1 compute node, 1 software installation
# 3 (can reduce to 2) assignment, 1 instance tree, 1 compute node, 1 software installation
# 1 software instance
# 2 credential request
related_object_list = project.Base_getRelatedObjectList()
assert len(related_object_list) == 8, [x.getRelativeUrl() for x in related_object_list]
assert len(related_object_list) == 9, [x.getRelativeUrl() for x in related_object_list]
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