Commit baf3565d authored by iv's avatar iv

ERP5Workflow: fix testERP5Workflow to use categories for after/before scripts

parent 72348545
...@@ -152,9 +152,7 @@ class TestERP5Workflow(ERP5TypeTestCase): ...@@ -152,9 +152,7 @@ class TestERP5Workflow(ERP5TypeTestCase):
title='State 2') title='State 2')
s1.setReference('s1') s1.setReference('s1')
s2.setReference('s2') s2.setReference('s2')
t1 = workflow.newContent(portal_type='Transition', t1 = workflow.newContent(portal_type='Transition', title='Transition 1')
title='Transition 1',
after_script_id='Document_testAfterScript')
t1.setReference('t1') t1.setReference('t1')
s1.setDestinationValue(t1) s1.setDestinationValue(t1)
t1.setDestinationValue(s2) t1.setDestinationValue(s2)
...@@ -165,6 +163,9 @@ class TestERP5Workflow(ERP5TypeTestCase): ...@@ -165,6 +163,9 @@ class TestERP5Workflow(ERP5TypeTestCase):
script.setParameterSignature("state_change") script.setParameterSignature("state_change")
script.setBody("state_change['object'].setDescription('After script was " + script.setBody("state_change['object'].setDescription('After script was " +
"executed.')") "executed.')")
t1.setCategoryList(t1.getCategoryList() +
['after_script/' + script.getRelativeUrl()])
self.getPortalObject().portal_types._getOb('Folder')\ self.getPortalObject().portal_types._getOb('Folder')\
.edit(type_workflow_list=('wf')) .edit(type_workflow_list=('wf'))
doc = self.portal.newContent(portal_type='Folder', id='test_doc') doc = self.portal.newContent(portal_type='Folder', id='test_doc')
...@@ -174,7 +175,7 @@ class TestERP5Workflow(ERP5TypeTestCase): ...@@ -174,7 +175,7 @@ class TestERP5Workflow(ERP5TypeTestCase):
# FIXME: not passing parameter to an after script is probably too # FIXME: not passing parameter to an after script is probably too
# restrictive # restrictive
def test_BeforeScript(self): def test_beforeScript(self):
workflow = self.workflow_module.newContent( workflow = self.workflow_module.newContent(
portal_type='Workflow') portal_type='Workflow')
workflow.setReference('wf') workflow.setReference('wf')
...@@ -185,10 +186,7 @@ class TestERP5Workflow(ERP5TypeTestCase): ...@@ -185,10 +186,7 @@ class TestERP5Workflow(ERP5TypeTestCase):
title='State 2') title='State 2')
s1.setReference('s1') s1.setReference('s1')
s2.setReference('s2') s2.setReference('s2')
t1 = workflow.newContent(portal_type='Transition', t1 = workflow.newContent(portal_type='Transition', title='Transition 1')
title='Transition 1',
before_script_id='Document_testBeforeScript',
)
t1.setReference('t1') t1.setReference('t1')
s1.setDestinationValue(t1) s1.setDestinationValue(t1)
t1.setDestinationValue(s2) t1.setDestinationValue(s2)
...@@ -198,7 +196,8 @@ class TestERP5Workflow(ERP5TypeTestCase): ...@@ -198,7 +196,8 @@ class TestERP5Workflow(ERP5TypeTestCase):
script.setParameterSignature("state_change") script.setParameterSignature("state_change")
script.setBody("state_change['object'].setDescription('Before script was " + script.setBody("state_change['object'].setDescription('Before script was " +
"executed.')") "executed.')")
t1.setCategoryList(t1.getCategoryList() +
['before_script/' + script.getRelativeUrl()])
self.getPortalObject().portal_types._getOb('Folder')\ self.getPortalObject().portal_types._getOb('Folder')\
.edit(type_workflow_list=('wf')) .edit(type_workflow_list=('wf'))
doc = self.portal.newContent(portal_type='Folder', id='test_doc') doc = self.portal.newContent(portal_type='Folder', id='test_doc')
......
  • Please use t1.setBeforeScriptValue(script)

    What is t1, a Terminator ? please change abbreviations

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