Commit 0e0b9ca0 authored by iv's avatar iv

ERP5Workflow: fix testSecurity guard check

parent 3e532286
......@@ -121,7 +121,7 @@ class TestSecurityMixin(ERP5TypeTestCase):
if getattr(transition, 'trigger_type', 1) == 0:
# Automatic transition without guard is safe
continue
if getattr(transition, 'guard', None) is None:
if not transition.isGuarded():
error_list.append('%s/transitions/%s' % (wf.getId(), transition.getId()))
if error_list:
message = '\nThe following %s workflow transitions are not guarded.\n\t%s' \
......
......@@ -71,7 +71,6 @@ def WorkflowUIMixin_setProperties( self, title
WorkflowUIMixin_class.setProperties = WorkflowUIMixin_setProperties
WorkflowUIMixin_class.manage_properties = DTMLFile('workflow_properties', _dtmldir)
def Guard_checkWithoutRoles(self, sm, wf_def, ob, **kw):
"""Checks conditions in this guard.
This function is the same as Guard.check, but roles are not taken
......@@ -1094,6 +1093,10 @@ def DCWorkflowDefinition_deleteTransitions(self, name):
def WorklistDefinition_getGuardRoleList(self):
return self.getGuard().getRolesText().split(';')
def method_isGuarded(self):
guard = getattr(self, 'guard', None)
return guard is not None
DCWorkflowDefinition.addTransition = DCWorkflowDefinition_addTransition
DCWorkflowDefinition.deleteTransitions = DCWorkflowDefinition_deleteTransitions
DCWorkflowDefinition.getReference = method_getReference
......@@ -1127,6 +1130,7 @@ StateDefinition.getStateTypeList = StateDefinition_getStateTypeList
TransitionDefinition.getParentValue = TransitionDefinition_getParentValue
TransitionDefinition.getReference = method_getReference
TransitionDefinition.showDict = DCWorkflowDefinition_showDict
TransitionDefinition.isGuarded = method_isGuarded
VariableDefinition.getReference = method_getReference
VariableDefinition.showDict = DCWorkflowDefinition_showDict
WorklistDefinition.getReference = method_getReference
......
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