Commit 51154039 authored by iv's avatar iv

ERP5Workflow: cosmetics + add XXX

parent 25120fff
......@@ -68,15 +68,15 @@ class TestERP5Workflow(ERP5TypeTestCase):
s1.setReference('s1')
s2.setReference('s2')
t1 = workflow.newContent(portal_type='Transition',
title='Transition 1',
)
title='Transition 1')
t1.setReference('t1')
s1.setDestinationValue(t1)
t1.setDestinationValue(s2)
# set initial state
workflow.setSourceValue(s1)
# create a document and associate it to this workflow
self.getPortalObject().portal_types._getOb('Folder').edit(type_workflow_list=('wf'))
self.getPortalObject().portal_types._getOb('Folder')\
.edit(type_workflow_list=('wf'))
doc = self.portal.newContent(portal_type='Folder', id='test_doc')
self.assertEqual('s1', workflow._getWorkflowStateOf(doc, id_only=1))
......@@ -86,8 +86,7 @@ class TestERP5Workflow(ERP5TypeTestCase):
def test_getAvailableTransitionList(self):
workflow = self.workflow_module.newContent(
portal_type='Workflow')
workflow = self.workflow_module.newContent(portal_type='Workflow')
workflow.setReference('wf')
workflow.setStateVariable('current_state')
s1 = workflow.newContent(portal_type='State',
......@@ -103,7 +102,8 @@ class TestERP5Workflow(ERP5TypeTestCase):
t2.setReference('t2')
s1.setDestinationValueList([t1, t2])
self.getPortalObject().portal_types._getOb('Folder').edit(type_workflow_list=('wf'))
self.getPortalObject().portal_types._getOb('Folder')\
.edit(type_workflow_list=('wf'))
doc = self.portal.newContent(portal_type='Folder', id='test_doc')
self.assertEqual([t1, t2], s1.getDestinationValueList())
......@@ -127,7 +127,8 @@ class TestERP5Workflow(ERP5TypeTestCase):
title='actor')
v1.setReference('actor')
v1.variable_expression = 'user/getUserName'
self.getPortalObject().portal_types._getOb('Folder').edit(type_workflow_list=('wf'))
self.getPortalObject().portal_types._getOb('Folder')\
.edit(type_workflow_list=('wf'))
doc = self.portal.newContent(portal_type='Folder', id='test_doc')
workflow._executeTransition(doc,t1)
current_state = workflow.getCurrentStatusDict(doc)
......@@ -141,8 +142,9 @@ class TestERP5Workflow(ERP5TypeTestCase):
def test_afterScript(self):
workflow = self.workflow_module.newContent(
portal_type='Workflow',
state_base_category='current_state')
portal_type='Workflow',
state_base_category='current_state'
)
workflow.setReference('wf')
s1 = workflow.newContent(portal_type='State',
title='State 1')
......@@ -152,17 +154,19 @@ class TestERP5Workflow(ERP5TypeTestCase):
s2.setReference('s2')
t1 = workflow.newContent(portal_type='Transition',
title='Transition 1',
after_script_id='Document_testAfterScript',
)
after_script_id='Document_testAfterScript')
t1.setReference('t1')
s1.setDestinationValue(t1)
t1.setDestinationValue(s2)
workflow.setSourceValue(s1)
script = workflow.newContent(portal_type='Workflow Script', id='Document_testAfterScript')
script = workflow.newContent(portal_type='Workflow Script',
id='Document_testAfterScript')
script.setParameterSignature("state_change")
script.setParameterSignature("state_change")
script.setBody("state_change['object'].setDescription('After script was executed.')")
self.getPortalObject().portal_types._getOb('Folder').edit(type_workflow_list=('wf'))
script.setBody("state_change['object'].setDescription('After script was " +
"executed.')")
self.getPortalObject().portal_types._getOb('Folder')\
.edit(type_workflow_list=('wf'))
doc = self.portal.newContent(portal_type='Folder', id='test_doc')
workflow._executeTransition(doc, t1)
......@@ -189,11 +193,14 @@ class TestERP5Workflow(ERP5TypeTestCase):
s1.setDestinationValue(t1)
t1.setDestinationValue(s2)
workflow.setSourceValue(s1)
script = workflow.newContent(portal_type='Workflow Script', id='Document_testBeforeScript')
script = workflow.newContent(portal_type='Workflow Script',
id='Document_testBeforeScript')
script.setParameterSignature("state_change")
script.setBody("state_change['object'].setDescription('Before script was executed.')")
script.setBody("state_change['object'].setDescription('Before script was " +
"executed.')")
self.getPortalObject().portal_types._getOb('Folder').edit(type_workflow_list=('wf'))
self.getPortalObject().portal_types._getOb('Folder')\
.edit(type_workflow_list=('wf'))
doc = self.portal.newContent(portal_type='Folder', id='test_doc')
workflow._executeTransition(doc, t1)
......@@ -220,7 +227,7 @@ class TestERP5Workflow(ERP5TypeTestCase):
#self.assertRaises(Unauthorized, workflow_module.view)
#self.assertRaises(Unauthorized, createWorkflowInstance)
#self.assertRaises(Unauthorized, lambda: workflow_instance.view())
# XXX(WORKFLOW): why is this commented? ^
def test_suite():
suite = unittest.TestSuite()
......
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