Commit 62dafa78 authored by wenjie.zheng's avatar wenjie.zheng Committed by Sebastien Robin

erp5_workflow_test_data: modification due to null workflow prefix.

parent 1b32e1f4
...@@ -16,10 +16,8 @@ class TestERP5WorkflowMixin(ERP5TypeTestCase): ...@@ -16,10 +16,8 @@ class TestERP5WorkflowMixin(ERP5TypeTestCase):
pass pass
def doActionFor(self, document, action): def doActionFor(self, document, action):
""" user_action = action
Need to be overidden self.portal.portal_workflow.doActionFor(document, user_action, wf_id = 'testing_workflow')
"""
pass
def getWorklistDocumentCountFromActionName(self, action_name): def getWorklistDocumentCountFromActionName(self, action_name):
self.assertEqual(action_name[-1], ')') self.assertEqual(action_name[-1], ')')
...@@ -195,16 +193,23 @@ class TestERP5WorkflowMixin(ERP5TypeTestCase): ...@@ -195,16 +193,23 @@ class TestERP5WorkflowMixin(ERP5TypeTestCase):
self.assertEqual(self.getStateFor(new_object), 'validated') self.assertEqual(self.getStateFor(new_object), 'validated')
self.assertEqual(workflow_tool.isTransitionPossible(new_object, 'invalidate'), 1) self.assertEqual(workflow_tool.isTransitionPossible(new_object, 'invalidate'), 1)
def test_13_testWorkflowHistroyBeforeAndAfterConversion(self):
pass
""" """
def beforeTearDown(self): def beforeTearDown(self):
self.abort()
self.portal = self.getPortal() self.portal = self.getPortal()
self.getWorkflowTool().setChainForPortalTypes(['ERP5Workflow Test Document'], ()) workflow_module = self.portal.portal_workflow
type_test_object = self.portal.portal_types._getOb('ERP5Workflow Test Document') workflow_module._delObject('testing_workflow')
type_test_object.edit(type_base_category_list=('validation_state',)) workflow_module._delObject('testing_interaction_workflow')
type_test_object.edit(type_workflow_list=('testing_workflow',)) workflow_module.testing_workflow = workflow_module.get('testing_workflow_backup')
#self.commit() workflow_module.testing_workflow.id = 'testing_workflow'
workflow_module.testing_interaction_workflow = workflow_module.get('testing_interaction_workflow_backup')
workflow_module.testing_interaction_workflow.id = 'testing_interaction_workflow'
super(TestERP5WorkflowMixin, self).beforeTearDown()
""" """
class TestConvertedWorkflow(TestERP5WorkflowMixin): class TestConvertedWorkflow(TestERP5WorkflowMixin):
""" """
Tests Converted Workflow. Tests Converted Workflow.
...@@ -221,16 +226,15 @@ class TestConvertedWorkflow(TestERP5WorkflowMixin): ...@@ -221,16 +226,15 @@ class TestConvertedWorkflow(TestERP5WorkflowMixin):
for dc_wf_id in dc_wf_id_list: for dc_wf_id in dc_wf_id_list:
self.workflow_module.delTypeCBT(ptype_id, dc_wf_id) self.workflow_module.delTypeCBT(ptype_id, dc_wf_id)
if not hasattr(self.workflow_module, 'workflow_'+dc_wf_id) and not hasattr(self.workflow_module, 'interactionworkflow_'+dc_wf_id): dc_wf = self.workflow_module._getOb(dc_wf_id)
# convert DC workflow to workflow: if dc_wf.getPortalType() not in ['Workflow', 'Interaction Workflow']:
dc_wf = self.workflow_module._getOb(dc_wf_id)
self.workflow_module.dc_workflow_asERP5Object(self.workflow_module, dc_wf, temp=0) self.workflow_module.dc_workflow_asERP5Object(self.workflow_module, dc_wf, temp=0)
#type_test_object.addTypeWorkflowList(workflow.id) #type_test_object.addTypeWorkflowList(workflow.id)
type_test_object.addTypeWorkflowList('interactionworkflow_testing_interaction_workflow') type_test_object.addTypeWorkflowList('testing_interaction_workflow')
type_test_object.addTypeWorkflowList('workflow_testing_workflow') type_test_object.addTypeWorkflowList('testing_workflow')
self.wf = self.workflow_module._getOb('workflow_testing_workflow') # workflow id comes with suffix self.wf = self.workflow_module._getOb('testing_workflow')
self.resetComponentTool() self.resetComponentTool()
self.assertFalse('testing_workflow' in self.getWorkflowTool().getChainFor(type_test_object.getId())) self.assertFalse('testing_workflow' in self.getWorkflowTool().getChainFor(type_test_object.getId()))
self.login() self.login()
...@@ -238,10 +242,6 @@ class TestConvertedWorkflow(TestERP5WorkflowMixin): ...@@ -238,10 +242,6 @@ class TestConvertedWorkflow(TestERP5WorkflowMixin):
def getStateFor(self, document): def getStateFor(self, document):
return getattr(document, 'getValidationState')() return getattr(document, 'getValidationState')()
def doActionFor(self, document, action):
user_action = action
self.portal.portal_workflow.doActionFor(document, user_action, wf_id = 'workflow_testing_workflow')
class TestDCWorkflow(TestERP5WorkflowMixin): class TestDCWorkflow(TestERP5WorkflowMixin):
""" """
Check DC Workflow Check DC Workflow
...@@ -261,12 +261,8 @@ class TestDCWorkflow(TestERP5WorkflowMixin): ...@@ -261,12 +261,8 @@ class TestDCWorkflow(TestERP5WorkflowMixin):
def getStateFor(self, document): def getStateFor(self, document):
return self.wf._getWorkflowStateOf(document, id_only=True) return self.wf._getWorkflowStateOf(document, id_only=True)
def doActionFor(self, document, action):
user_action = action
self.portal.portal_workflow.doActionFor(document, user_action, wf_id = 'testing_workflow')
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestConvertedWorkflow))
suite.addTest(unittest.makeSuite(TestDCWorkflow)) suite.addTest(unittest.makeSuite(TestDCWorkflow))
suite.addTest(unittest.makeSuite(TestConvertedWorkflow))
return suite return suite
\ No newline at end of file
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