Commit 82e29250 authored by Vincent Pelletier's avatar Vincent Pelletier

Use global assertWorkflowTransitionFails instead of a local duplication...

Use global assertWorkflowTransitionFails instead of a local duplication (originaly duplicated to work with old version of ERP5Type).


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13784 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1aecc505
...@@ -161,25 +161,6 @@ class TestERP5BankingAccountIncident(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -161,25 +161,6 @@ class TestERP5BankingAccountIncident(TestERP5BankingMixin, ERP5TypeTestCase):
# open counter date # open counter date
self.openCounterDate(site=self.paris) self.openCounterDate(site=self.paris)
def genericAssertWorkflowTransitionFails(self, object, workflow_id, transition_id, error_message=None):
"""
Check that passing given transition from given workflow on given object
raises ValidationFailed.
Do sanity checks (workflow history length increased by one, simulation
state unchanged).
If error_message is provided, it will be asserted equal to the last
workflow history error message.
"""
reference_history_length = len(self.workflow_tool.getInfoFor(ob=object, name='history', wf_id=workflow_id))
reference_workflow_state = object.getSimulationState()
self.assertRaises(ValidationFailed, self.workflow_tool.doActionFor, object, transition_id, wf_id=workflow_id)
workflow_history = self.workflow_tool.getInfoFor(ob=object, name='history', wf_id=workflow_id)
self.assertEqual(len(workflow_history), reference_history_length + 1)
if error_message is not None:
self.assertEqual(str(workflow_history[-1]['error_message']), error_message)
self.assertEqual(object.getSimulationState(), reference_workflow_state)
def stepCleanupObjects(self, sequence=None, sequence_list=None, **kwd): def stepCleanupObjects(self, sequence=None, sequence_list=None, **kwd):
""" """
Cleanup account_incident_module after a sequence execution so that Cleanup account_incident_module after a sequence execution so that
...@@ -353,7 +334,7 @@ class TestERP5BankingAccountIncident(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -353,7 +334,7 @@ class TestERP5BankingAccountIncident(TestERP5BankingMixin, ERP5TypeTestCase):
""" """
# fix amount (10000 * 5.0 + 200 * 12.0 + 5000 * 24) # fix amount (10000 * 5.0 + 200 * 12.0 + 5000 * 24)
self.account_incident.setSourceTotalAssetPrice('172400.0') self.account_incident.setSourceTotalAssetPrice('172400.0')
self.genericAssertWorkflowTransitionFails(object=self.account_incident, transition_id='confirm_action', workflow_id='account_incident_workflow', error_message="You can't have excess and deficit on the document.") self.assertWorkflowTransitionFails(object=self.account_incident, transition_id='confirm_action', workflow_id='account_incident_workflow', error_message="You can't have excess and deficit on the document.")
def stepDelOutgoingLine(self, sequence=None, sequence_list=None, **kwd): def stepDelOutgoingLine(self, sequence=None, sequence_list=None, **kwd):
...@@ -368,7 +349,7 @@ class TestERP5BankingAccountIncident(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -368,7 +349,7 @@ class TestERP5BankingAccountIncident(TestERP5BankingMixin, ERP5TypeTestCase):
Try to confirm the cash transfer with a bad cash transfer line and Try to confirm the cash transfer with a bad cash transfer line and
check the try of confirm the cash transfer with the invalid line has failed check the try of confirm the cash transfer with the invalid line has failed
""" """
self.genericAssertWorkflowTransitionFails(object=self.account_incident, transition_id='confirm_action', workflow_id='account_incident_workflow', error_message="Price differs between document and resource.") self.assertWorkflowTransitionFails(object=self.account_incident, transition_id='confirm_action', workflow_id='account_incident_workflow', error_message="Price differs between document and resource.")
def stepTryConfirmAccountIncidentWithNoResource(self, sequence=None, sequence_list=None, **kwd): def stepTryConfirmAccountIncidentWithNoResource(self, sequence=None, sequence_list=None, **kwd):
""" """
...@@ -377,7 +358,7 @@ class TestERP5BankingAccountIncident(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -377,7 +358,7 @@ class TestERP5BankingAccountIncident(TestERP5BankingMixin, ERP5TypeTestCase):
original_resource_path = self.account_incident.getResource() original_resource_path = self.account_incident.getResource()
self.account_incident.setResource('') self.account_incident.setResource('')
self.assertEqual(self.account_incident.getResourceValue(), None) self.assertEqual(self.account_incident.getResourceValue(), None)
self.genericAssertWorkflowTransitionFails(object=self.account_incident, transition_id='confirm_action', workflow_id='account_incident_workflow', error_message="No resource defined.") self.assertWorkflowTransitionFails(object=self.account_incident, transition_id='confirm_action', workflow_id='account_incident_workflow', error_message="No resource defined.")
self.account_incident.setResource(original_resource_path) self.account_incident.setResource(original_resource_path)
def stepCheckTotal(self, sequence=None, sequence_list=None, **kwd): def stepCheckTotal(self, sequence=None, sequence_list=None, **kwd):
......
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