From 54374b65f9cb5df9d6b6ef16d73ddfe3031999ec Mon Sep 17 00:00:00 2001 From: Romain Courteaud <romain@nexedi.com> Date: Tue, 15 Apr 2008 08:01:49 +0000 Subject: [PATCH] Check that it's possible to wrap a worflow transition. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20510 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/tests/testInteractionWorkflow.py | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/product/ERP5/tests/testInteractionWorkflow.py b/product/ERP5/tests/testInteractionWorkflow.py index d5b7cd4a07..3c202395bd 100644 --- a/product/ERP5/tests/testInteractionWorkflow.py +++ b/product/ERP5/tests/testInteractionWorkflow.py @@ -60,7 +60,7 @@ class TestInteractionWorkflow(ERP5TypeTestCase): def login(self, quiet=0): uf = self.getPortal().acl_users - uf._doAddUser('seb', '', ['Manager'], []) + uf._doAddUser('seb', '', ['Manager', 'Assignor'], []) user = uf.getUserById('seb').__of__(uf) newSecurityManager(None, user) @@ -90,7 +90,7 @@ class TestInteractionWorkflow(ERP5TypeTestCase): wf.interactions.addInteraction(id='edit_interaction') self.interaction = wf.interactions['edit_interaction'] self.getWorkflowTool().setChainForPortalTypes( - [self.portal_type],'test_workflow') + [self.portal_type],'test_workflow, validation_workflow') _aq_reset() # XXX Fails XXX _setLastId not found when doing newContent def createInteractionWorkflowWithTwoInteractions(self): @@ -110,7 +110,7 @@ class TestInteractionWorkflow(ERP5TypeTestCase): wf.interactions.addInteraction(id='editB') self.interactionB = wf.interactions['editB'] self.getWorkflowTool().setChainForPortalTypes( - [self.portal_type],'test_workflow') + [self.portal_type],'test_workflow, validation_workflow') _aq_reset() # XXX Fails XXX _setLastId not found when doing newContent def test_01(self, quiet=0, run=run_all_test): @@ -572,6 +572,22 @@ context.setDescription('%s,%s,%s' % (d, args, result)) self.assertEquals(self.organisation.doSomethingStupid__roles__, ()) + def test_wrap_workflow_transition(self): + self.logMessage('Wrap workflow transition') + self.createInteractionWorkflow() + self.interaction.setProperties( + 'default', + method_id='validate', + after_script_name=('afterEdit',)) + params = 'sci, **kw' + body = "context = sci[\'object\']\n" +\ + "context.setDescription('titi')" + self.script.ZPythonScript_edit(params, body) + self.createData() + self.assertEquals('', self.organisation.getDescription()) + self.portal.portal_workflow.doActionFor(self.organisation, 'validate_action') + self.assertEquals('validated', self.organisation.getValidationState()) + self.assertEquals('titi', self.organisation.getDescription()) def test_suite(): suite = unittest.TestSuite() -- 2.30.9