Commit ef1cf2b3 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

erp5_core_test: fix typos.

parent 61aa34c1
......@@ -966,19 +966,19 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
# Add a non-existent workflow.
pw = self.getWorkflowTool()
dummy_simulation_worlflow_id = 'fake_simulation_workflow'
dummy_validation_worlflow_id = 'fake_validation_workflow'
dummy_simulation_workflow_id = 'fake_simulation_workflow'
dummy_validation_workflow_id = 'fake_validation_workflow'
#Assume that erp5_styles workflow Manage permissions with acquired Role by default
addWorkflowByType(pw, 'erp5_workflow', dummy_simulation_worlflow_id)
addWorkflowByType(pw, 'erp5_workflow', dummy_validation_worlflow_id)
dummy_simulation_worlflow = pw[dummy_simulation_worlflow_id]
dummy_validation_worlflow = pw[dummy_validation_worlflow_id]
dummy_validation_worlflow.variables.setStateVar('validation_state')
addWorkflowByType(pw, 'erp5_workflow', dummy_simulation_workflow_id)
addWorkflowByType(pw, 'erp5_workflow', dummy_validation_workflow_id)
dummy_simulation_workflow = pw[dummy_simulation_workflow_id]
dummy_validation_workflow = pw[dummy_validation_workflow_id]
dummy_validation_workflow.variables.setStateVar('validation_state')
organisation_type = portal.portal_types.getTypeInfo(portal_type)
organisation_initial_workflow_list = organisation_type.getTypeWorkflowList()
organisation_type.setTypeWorkflowList([dummy_validation_worlflow_id,
dummy_simulation_worlflow_id])
permission_list = list(dummy_simulation_worlflow.permissions)
organisation_type.setTypeWorkflowList([dummy_validation_workflow_id,
dummy_simulation_workflow_id])
permission_list = list(dummy_simulation_workflow.permissions)
manager_has_permission = {}
for permission in permission_list:
manager_has_permission[permission] = ('Manager',)
......@@ -989,7 +989,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
user = getSecurityManager().getUser()
try:
self.assertTrue(permission_list)
self.assertFalse(dummy_simulation_worlflow.states.draft.permission_roles)
self.assertFalse(dummy_simulation_workflow.states.draft.permission_roles)
#1
obj = module.newContent(portal_type=portal_type)
#No role is defined by default on workflow
......@@ -999,28 +999,28 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
for permission in permission_list:
self.assertTrue(user.has_permission(permission, obj))
#2 Now configure both workflow with same configuration
dummy_simulation_worlflow.states.draft.permission_roles = manager_has_permission.copy()
dummy_validation_worlflow.states.draft.permission_roles = manager_has_permission.copy()
dummy_simulation_worlflow.updateRoleMappingsFor(obj)
dummy_validation_worlflow.updateRoleMappingsFor(obj)
dummy_simulation_workflow.states.draft.permission_roles = manager_has_permission.copy()
dummy_validation_workflow.states.draft.permission_roles = manager_has_permission.copy()
dummy_simulation_workflow.updateRoleMappingsFor(obj)
dummy_validation_workflow.updateRoleMappingsFor(obj)
for permission in permission_list:
self.assertTrue(user.has_permission(permission, obj))
#3 change only dummy_simulation_worlflow
dummy_simulation_worlflow.states.draft.permission_roles = manager_has_no_permission.copy()
dummy_simulation_worlflow.updateRoleMappingsFor(obj)
#3 change only dummy_simulation_workflow
dummy_simulation_workflow.states.draft.permission_roles = manager_has_no_permission.copy()
dummy_simulation_workflow.updateRoleMappingsFor(obj)
for permission in permission_list:
self.assertFalse(user.has_permission(permission, obj))
#4 enable acquisition for dummy_simulation_worlflow
dummy_simulation_worlflow.states.draft.permission_roles = None
dummy_simulation_worlflow.updateRoleMappingsFor(obj)
#4 enable acquisition for dummy_simulation_workflow
dummy_simulation_workflow.states.draft.permission_roles = None
dummy_simulation_workflow.updateRoleMappingsFor(obj)
for permission in permission_list:
self.assertTrue(user.has_permission(permission, obj))
finally:
# Make sure that the artificial workflow is not referred to any longer.
organisation_type.setTypeWorkflowList(organisation_initial_workflow_list)
pw.manage_delObjects([dummy_simulation_worlflow_id, dummy_validation_worlflow_id])
pw.manage_delObjects([dummy_simulation_workflow_id, dummy_validation_workflow_id])
def test_getViewPermissionOwnerDefault(self):
"""Test getViewPermissionOwner method behaviour"""
......
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