Commit fbcbe32e authored by Aurel's avatar Aurel

modify unit test to use new worfklow state and transition

add more checks on the stock


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24416 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 196f230f
...@@ -71,7 +71,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -71,7 +71,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
- create an invalid Line (quantity > available at source) - create an invalid Line (quantity > available at source)
- check that the system behaves correctly - check that the system behaves correctly
- pass "confirm_action" transition - pass "plan_action" transition
- check that the new state is confirmed - check that the new state is confirmed
- check that the source has been debited correctly (current < future) - check that the source has been debited correctly (current < future)
- check amount, lines, ... - check amount, lines, ...
...@@ -624,7 +624,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -624,7 +624,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
self.stepTic() self.stepTic()
# get state # get state
state = self.monetary_destruction.getSimulationState() state = self.monetary_destruction.getSimulationState()
# check state is confirmed # check state is planned
self.assertEqual(state, 'planned') self.assertEqual(state, 'planned')
# get workflow history # get workflow history
...@@ -635,10 +635,12 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -635,10 +635,12 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
""" """
# check we have 5 banknotes of 10000 currently # check we have 5 banknotes of 10000 currently
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.source.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 5.0) self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.source.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 5.0)
self.assertEqual(self.simulation_tool.getAvailableInventory(node=self.source.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 5.0)
# check we will have 0 banknote of 10000 after deliver # check we will have 0 banknote of 10000 after deliver
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.source.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 0.0) self.assertEqual(self.simulation_tool.getFutureInventory(node=self.source.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 0.0)
# check we have 24 banknotes of 5000 currently # check we have 24 banknotes of 5000 currently
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.source.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 24.0) self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.source.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 24.0)
self.assertEqual(self.simulation_tool.getAvailableInventory(node=self.source.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 24.0)
# check we will have 0 banknote of 5000 after deliver # check we will have 0 banknote of 5000 after deliver
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.source.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 0.0) self.assertEqual(self.simulation_tool.getFutureInventory(node=self.source.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 0.0)
...@@ -649,14 +651,29 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -649,14 +651,29 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
""" """
# check we have 5 banknotes of 10000 currently # check we have 5 banknotes of 10000 currently
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 5.0) self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 5.0)
self.assertEqual(self.simulation_tool.getAvailableInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 5.0)
# check we will have 0 banknote of 10000 after deliver # check we will have 0 banknote of 10000 after deliver
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 0.0) self.assertEqual(self.simulation_tool.getFutureInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 0.0)
# check we have 24 banknotes of 5000 currently # check we have 24 banknotes of 5000 currently
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 24.0) self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 24.0)
self.assertEqual(self.simulation_tool.getAvailableInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 24.0)
# check we will have 0 banknote of 5000 after deliver # check we will have 0 banknote of 5000 after deliver
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 0.0) self.assertEqual(self.simulation_tool.getFutureInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 0.0)
def stepCheckSourceDebitAvailableForExterne(self, sequence=None, sequence_list=None, **kwd):
"""
Check that compution of inventory at vault source is right after confirm and before deliver
"""
# check we have 5 banknotes of 10000 currently
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 0.0)
# check we will have 0 banknote of 10000 after deliver
self.assertEqual(self.simulation_tool.getAvailableInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 0.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 0.0)
# check we have 24 banknotes of 5000 currently
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 0.0)
# check we will have 0 banknote of 5000 after deliver
self.assertEqual(self.simulation_tool.getAvailableInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 0.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 0.0)
def stepValidateMonetaryDestruction(self, sequence=None, sequence_list=None, **kwd): def stepValidateMonetaryDestruction(self, sequence=None, sequence_list=None, **kwd):
""" """
...@@ -681,9 +698,11 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -681,9 +698,11 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
""" """
# check we have 0 banknote of 10000 # check we have 0 banknote of 10000
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.source.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 0.0) self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.source.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 0.0)
self.assertEqual(self.simulation_tool.getAvailableInventory(node=self.source.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 0.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.source.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 0.0) self.assertEqual(self.simulation_tool.getFutureInventory(node=self.source.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 0.0)
# check we have 0 banknote of 5000 # check we have 0 banknote of 5000
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.source.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 0.0) self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.source.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 0.0)
self.assertEqual(self.simulation_tool.getAvailableInventory(node=self.source.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 0.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.source.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 0.0) self.assertEqual(self.simulation_tool.getFutureInventory(node=self.source.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 0.0)
...@@ -693,9 +712,11 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -693,9 +712,11 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
""" """
# check we have 0 banknote of 10000 # check we have 0 banknote of 10000
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 0.0) self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 0.0)
self.assertEqual(self.simulation_tool.getAvailableInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 0.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 0.0) self.assertEqual(self.simulation_tool.getFutureInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 0.0)
# check we have 0 banknote of 5000 # check we have 0 banknote of 5000
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 0.0) self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 0.0)
self.assertEqual(self.simulation_tool.getAvailableInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 0.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 0.0) self.assertEqual(self.simulation_tool.getFutureInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 0.0)
def stepPlanMonetaryDestruction(self, sequence=None, sequence_list=None, **kwd): def stepPlanMonetaryDestruction(self, sequence=None, sequence_list=None, **kwd):
...@@ -721,41 +742,41 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -721,41 +742,41 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
sequence=None, sequence_list=None, **kwd): sequence=None, sequence_list=None, **kwd):
self.monetary_destruction.setSourceTotalAssetPrice('2400.0') self.monetary_destruction.setSourceTotalAssetPrice('2400.0')
def stepOrderMonetaryDestruction(self, sequence=None, sequence_list=None, **kwd): def stepStartMonetaryDestruction(self, sequence=None, sequence_list=None, **kwd):
""" """
Confirm the monetary_destruction and check it Confirm the monetary_destruction and check it
""" """
# do the Workflow action # do the Workflow action
self.workflow_tool.doActionFor(self.monetary_destruction, 'order_action', wf_id='monetary_destruction_workflow') self.workflow_tool.doActionFor(self.monetary_destruction, 'start_action', wf_id='monetary_destruction_workflow')
# execute tic # execute tic
self.stepTic() self.stepTic()
# get state # get state
state = self.monetary_destruction.getSimulationState() state = self.monetary_destruction.getSimulationState()
# check state is ordered # check state is started
self.assertEqual(state, 'ordered') self.assertEqual(state, 'started')
# get workflow history # get workflow history
workflow_history = self.workflow_tool.getInfoFor(ob=self.monetary_destruction, name='history', wf_id='monetary_destruction_workflow') workflow_history = self.workflow_tool.getInfoFor(ob=self.monetary_destruction, name='history', wf_id='monetary_destruction_workflow')
def stepConfirmMonetaryDestruction(self, sequence=None, sequence_list=None, **kwd): def stepStopMonetaryDestruction(self, sequence=None, sequence_list=None, **kwd):
""" """
Confirm the monetary_destruction and check it Confirm the monetary_destruction and check it
""" """
# do the Workflow action # do the Workflow action
self.workflow_tool.doActionFor(self.monetary_destruction, 'confirm_action', wf_id='monetary_destruction_workflow', stop_date=DateTime().Date()) self.workflow_tool.doActionFor(self.monetary_destruction, 'stop_action', wf_id='monetary_destruction_workflow', stop_date=DateTime().Date())
# execute tic # execute tic
self.stepTic() self.stepTic()
# get state # get state
state = self.monetary_destruction.getSimulationState() state = self.monetary_destruction.getSimulationState()
# check state is confirmed # check state is stopped
self.assertEqual(state, 'confirmed') self.assertEqual(state, 'stopped')
def stepConfirmToDeliverMonetaryDestruction(self, sequence=None, sequence_list=None, **kwd): def stepStoppedToDeliverMonetaryDestruction(self, sequence=None, sequence_list=None, **kwd):
""" """
Deliver the monetary_destruction with a good user Deliver the monetary_destruction with a good user
and check that the deliver of a cash tranfer have achieved and check that the deliver of a cash tranfer have achieved
""" """
# do the workflow transition "deliver_action" # do the workflow transition "deliver_action"
self.workflow_tool.doActionFor(self.monetary_destruction, 'deliver_action', wf_id='monetary_destruction_workflow') self.workflow_tool.doActionFor(self.monetary_destruction, 'stop_to_deliver_action', wf_id='monetary_destruction_workflow')
# execute tic # execute tic
self.stepTic() self.stepTic()
# get state of monetary_destruction # get state of monetary_destruction
...@@ -811,20 +832,20 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -811,20 +832,20 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
+ 'CreateValidLine1 CheckSubTotal ' \ + 'CreateValidLine1 CheckSubTotal ' \
+ 'CreateValidLine2 CheckTotal ' \ + 'CreateValidLine2 CheckTotal ' \
+ 'CheckInitialInventory ' \ + 'CheckInitialInventory ' \
+ 'CreateInvalidLine ' \ + 'CreateInvalidLine Tic ' \
+ 'TryPlannedMonetaryDestructionWithBadInventory ' \ + 'TryPlannedMonetaryDestructionWithBadInventory ' \
+ 'DelInvalidLine Tic CheckTotal ' \ + 'DelInvalidLine Tic CheckTotal ' \
+ 'SetMonetaryDestructionSourceTotalAssetPrice ' \ + 'SetMonetaryDestructionSourceTotalAssetPrice ' \
+ 'Tic CheckWorklist ' \ + 'Tic CheckWorklist ' \
+ 'PlannedMonetaryDestruction ' \ + 'PlannedMonetaryDestruction Tic ' \
+ 'CheckSourceDebitPlanned ' \ + 'CheckSourceDebitPlanned ' \
+ 'ResetInventory Tic ' \ + 'ResetInventory Tic ' \
+ 'ValidateFails ' \ + 'ValidateFails ' \
+ 'DeleteResetInventory Tic ' \ + 'DeleteResetInventory ' \
+ 'Tic CheckWorklist ' \ + 'Tic CheckWorklist ' \
+ 'ValidateMonetaryDestruction ' \ + 'ValidateMonetaryDestruction Tic ' \
+ 'CheckSourceDebit ' \ + 'CheckSourceDebit ' \
+ 'Tic DelMonetaryDestruction Tic' + 'DelMonetaryDestruction Tic'
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
# This is the case of a destruction for another agency # This is the case of a destruction for another agency
...@@ -833,20 +854,19 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -833,20 +854,19 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
+ 'CreateValidLineForExterne1 CheckSubTotal ' \ + 'CreateValidLineForExterne1 CheckSubTotal ' \
+ 'CreateValidLineForExterne2 CheckTotal ' \ + 'CreateValidLineForExterne2 CheckTotal ' \
+ 'CheckInitialInventoryForExterne ' \ + 'CheckInitialInventoryForExterne ' \
+ 'CreateInvalidLine ' \ + 'CreateInvalidLine Tic ' \
+ 'TryPlannedMonetaryDestructionWithBadInventory ' \ + 'TryPlannedMonetaryDestructionWithBadInventory ' \
+ 'DelInvalidLine Tic CheckTotal ' \ + 'DelInvalidLine Tic CheckTotal ' \
+ 'SetMonetaryDestructionSourceTotalAssetPrice ' \ + 'SetMonetaryDestructionSourceTotalAssetPrice ' \
+ 'PlanMonetaryDestruction ' \ + 'PlanMonetaryDestruction ' \
+ 'CheckSourceDebitPlannedForExterne ' \ + 'CheckSourceDebitPlannedForExterne ' \
+ 'OrderMonetaryDestruction ' \ + 'StartMonetaryDestruction Tic ' \
+ 'ConfirmMonetaryDestruction ' \ + 'CheckSourceDebitAvailableForExterne ' \
+ 'ResetInventoryForExterne Tic ' \ + 'StopMonetaryDestruction Tic ' \
+ 'DeliverFails ' \ + 'CheckSourceDebitAvailableForExterne ' \
+ 'DeleteResetInventory Tic ' \ + 'StoppedToDeliverMonetaryDestruction Tic ' \
+ 'ConfirmToDeliverMonetaryDestruction ' \
+ 'CheckSourceDebitForExterne ' \ + 'CheckSourceDebitForExterne ' \
+ 'Tic DelMonetaryDestruction Tic ' + 'DelMonetaryDestruction Tic '
sequence_list.addSequenceString(another_sequence_string) sequence_list.addSequenceString(another_sequence_string)
......
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