Commit 65679398 authored by Sebastien Robin's avatar Sebastien Robin

check stock values in deliver action for some check and checkbook modules

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14028 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8739cb72
......@@ -128,7 +128,7 @@ class TestERP5BankingCashSortingIncident(TestERP5BankingMixin, ERP5TypeTestCase)
'variation_value': ('emission_letter/p', 'cash_status/valid') + self.variation_list,
'quantity': self.quantity_200}
line_list = [inventory_dict_line_1, inventory_dict_line_2]
self.line_list = line_list = [inventory_dict_line_1, inventory_dict_line_2]
self.diff_vault = self.paris.surface.caisse_courante.encaisse_des_billets_et_monnaies
self.createCashInventory(source=None, destination=self.diff_vault, currency=self.currency_1,
line_list=line_list)
......@@ -447,8 +447,6 @@ class TestERP5BankingCashSortingIncident(TestERP5BankingMixin, ERP5TypeTestCase)
self.assertEqual(state, 'delivered')
# get workflow history
workflow_history = self.workflow_tool.getInfoFor(ob=self.cash_sorting_incident, name='history', wf_id='cash_sorting_incident_workflow')
# check len of len workflow history is 6
self.assertEqual(len(workflow_history), 8)
def stepCheckFinalIncomingInventory(self, sequence=None, sequence_list=None, **kwd):
......@@ -475,6 +473,24 @@ class TestERP5BankingCashSortingIncident(TestERP5BankingMixin, ERP5TypeTestCase)
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.diff_vault.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 0.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.diff_vault.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 0.0)
def stepResetSourceInventory(self,
sequence=None, sequence_list=None, **kwd):
"""
Reset a vault
"""
node = self.diff_vault
line_list = self.line_list
self.resetInventory(destination=node, currency=self.currency_1,
line_list=line_list,extra_id='_reset_out')
def stepDeliverCashSortingIncidentFails(self, sequence=None, sequence_list=None, **kwd):
"""
Try if we get Insufficient balance
"""
message = self.assertWorkflowTransitionFails(self.cash_sorting_incident,
'cash_sorting_incident_workflow','deliver_action')
self.failUnless(message.find('Insufficient balance')>=0)
##################################
## Tests
......@@ -512,6 +528,9 @@ class TestERP5BankingCashSortingIncident(TestERP5BankingMixin, ERP5TypeTestCase)
+ 'SetOutgoingTotalAssetPrice ' \
+ 'PlanCashSortingIncident ' \
+ 'ConfirmCashSortingIncident ' \
+ 'ResetSourceInventory Tic ' \
+ 'DeliverCashSortingIncidentFails Tic ' \
+ 'DeleteResetInventory Tic ' \
+ 'DeliverCashSortingIncident ' \
+ 'Tic ' \
+ 'CheckFinalOutgoingInventory '
......
......@@ -128,6 +128,8 @@ class TestERP5BankingCheckbookDeliveryMixin:
# in the source
self.createCheckbookReception()
self.checkItemsCreated()
get_transaction().commit()
self.tic()
self.createCheckbookVaultTransfer()
......@@ -241,10 +243,6 @@ class TestERP5BankingCheckbookDelivery(TestERP5BankingCheckbookDeliveryMixin,
# check that checks are issued
check = self.checkbook_1.objectValues()[0]
self.assertEqual(check.getSimulationState(),'confirmed')
# get workflow history
workflow_history = self.workflow_tool.getInfoFor(ob=self.checkbook_delivery,
name='history', wf_id='checkbook_delivery_workflow')
self.assertEqual(len(workflow_history), 3)
def stepCheckFinalCheckbookInventory(self, sequence=None, sequence_list=None, **kw):
......@@ -265,6 +263,24 @@ class TestERP5BankingCheckbookDelivery(TestERP5BankingCheckbookDeliveryMixin,
checkbook_object_list = [x.getObject() for x in checkbook_list]
self.failIfDifferentSet(checkbook_object_list,[self.check_1])
def stepChangePreviousDeliveryDate(self,
sequence=None, sequence_list=None, **kwd):
"""
Reset a vault
"""
self.previous_delivery = self.checkbook_vault_transfer
self.previous_date = self.previous_delivery.getStartDate()
self.previous_delivery.edit(start_date=self.date+5)
def stepDeliverCheckbookDeliveryFails(self, sequence=None, sequence_list=None, **kwd):
"""
Try if we get Insufficient balance
"""
message = self.assertWorkflowTransitionFails(self.checkbook_delivery,
'checkbook_delivery_workflow','deliver_action')
self.failUnless(message.find('Sorry, the item with reference')>=0)
self.failUnless(message.find('is not available any more')>=0)
##################################
## Tests
##################################
......@@ -279,6 +295,9 @@ class TestERP5BankingCheckbookDelivery(TestERP5BankingCheckbookDeliveryMixin,
sequence_string = 'Tic CheckObjects Tic CheckInitialCheckbookInventory ' \
+ 'CreateCheckbookDelivery Tic ' \
+ 'CreateCheckAndCheckbookLineList Tic ' \
+ 'ChangePreviousDeliveryDate Tic ' \
+ 'DeliverCheckbookDeliveryFails Tic ' \
+ 'PutBackPreviousDeliveryDate Tic ' \
+ 'DeliverCheckbookDelivery Tic ' \
+ 'CheckFinalCheckbookInventory'
sequence_list.addSequenceString(sequence_string)
......
......@@ -277,10 +277,6 @@ class TestERP5BankingCheckbookMovement(TestERP5BankingCheckbookVaultTransferMixi
state = self.checkbook_movement.getSimulationState()
# check that state is delivered
self.assertEqual(state, 'delivered')
# get workflow history
workflow_history = self.workflow_tool.getInfoFor(ob=self.checkbook_movement,
name='history', wf_id='checkbook_movement_workflow')
self.assertEqual(len(workflow_history), 9)
def stepCheckFinalCheckbookInventory(self, sequence=None, sequence_list=None, **kw):
......@@ -301,6 +297,24 @@ class TestERP5BankingCheckbookMovement(TestERP5BankingCheckbookVaultTransferMixi
self.assertEqual(len(self.simulation_tool.getFutureTrackingList(
node=self.destination_vault.getRelativeUrl())), 2)
def stepChangePreviousDeliveryDate(self,
sequence=None, sequence_list=None, **kwd):
"""
Reset a vault
"""
self.previous_delivery = self.checkbook_reception
self.previous_date = self.previous_delivery.getStartDate()
self.previous_delivery.edit(start_date=self.date+5)
def stepDeliverCheckbookMovementFails(self, sequence=None, sequence_list=None, **kwd):
"""
Try if we get Insufficient balance
"""
message = self.assertWorkflowTransitionFails(self.checkbook_movement,
'checkbook_movement_workflow','confirm_to_deliver_action')
self.failUnless(message.find('Sorry, the item with reference')>=0)
self.failUnless(message.find('is not available any more')>=0)
##################################
## Tests
##################################
......@@ -319,6 +333,9 @@ class TestERP5BankingCheckbookMovement(TestERP5BankingCheckbookVaultTransferMixi
+ 'OrderCheckbookMovement Tic ' \
+ 'ConfirmCheckbookMovement Tic ' \
+ 'CheckConfirmedCheckbookInventory Tic ' \
+ 'ChangePreviousDeliveryDate Tic ' \
+ 'DeliverCheckbookMovementFails Tic ' \
+ 'PutBackPreviousDeliveryDate Tic ' \
+ 'DeliverCheckbookMovement Tic ' \
+ 'CheckFinalCheckbookInventory'
sequence_list.addSequenceString(sequence_string)
......
......@@ -111,7 +111,6 @@ class TestERP5BankingCheckbookUsualCashTransferMixin(
self.workflow_tool.doActionFor(self.checkbook_vault_transfer, 'confirm_to_deliver_action',
wf_id='checkbook_vault_transfer_workflow')
class TestERP5BankingCheckbookUsualCashTransfer(TestERP5BankingCheckbookUsualCashTransferMixin,
TestERP5BankingMixin, ERP5TypeTestCase):
"""
......@@ -328,10 +327,6 @@ class TestERP5BankingCheckbookUsualCashTransfer(TestERP5BankingCheckbookUsualCas
state = self.checkbook_usual_cash_transfer.getSimulationState()
# check that state is delivered
self.assertEqual(state, 'delivered')
# get workflow history
workflow_history = self.workflow_tool.getInfoFor(ob=self.checkbook_usual_cash_transfer,
name='history', wf_id='checkbook_usual_cash_transfer_workflow')
def stepCheckFinalCheckbookInventory(self, sequence=None, sequence_list=None, **kw):
"""
......@@ -363,6 +358,24 @@ class TestERP5BankingCheckbookUsualCashTransfer(TestERP5BankingCheckbookUsualCas
node=self.destination_vault.getRelativeUrl(),
at_date=self.date)), 2)
def stepChangePreviousDeliveryDate(self,
sequence=None, sequence_list=None, **kwd):
"""
Reset a vault
"""
self.previous_delivery = self.checkbook_vault_transfer
self.previous_date = self.previous_delivery.getStartDate()
self.previous_delivery.edit(start_date=self.date+5)
def stepDeliverCheckbookUsualCashTransferFails(self, sequence=None, sequence_list=None, **kwd):
"""
Try if we get Insufficient balance
"""
message = self.assertWorkflowTransitionFails(self.checkbook_usual_cash_transfer,
'checkbook_usual_cash_transfer_workflow','confirm_to_deliver_action')
self.failUnless(message.find('Sorry, the item with reference')>=0)
self.failUnless(message.find('is not available any more')>=0)
##################################
## Tests
##################################
......@@ -381,6 +394,9 @@ class TestERP5BankingCheckbookUsualCashTransfer(TestERP5BankingCheckbookUsualCas
+ 'ChangeCheckbookUsualCashTransferStartDate Tic ' \
+ 'ConfirmCheckbookUsualCashTransfer Tic ' \
+ 'CheckConfirmedCheckbookInventory Tic ' \
+ 'ChangePreviousDeliveryDate Tic ' \
+ 'DeliverCheckbookUsualCashTransferFails Tic ' \
+ 'PutBackPreviousDeliveryDate Tic ' \
+ 'DeliverCheckbookUsualCashTransfer Tic ' \
+ 'CheckFinalCheckbookInventory'
sequence_list.addSequenceString(sequence_string)
......
......@@ -136,6 +136,13 @@ class TestERP5BankingCheckbookVaultTransferMixin:
else:
self.assertNotEquals(traveler_check,None)
def stepPutBackPreviousDeliveryDate(self,
sequence=None, sequence_list=None, **kwd):
"""
Put back right inventory
"""
self.previous_delivery.edit(start_date=self.previous_date)
class TestERP5BankingCheckbookVaultTransfer(TestERP5BankingCheckbookVaultTransferMixin,
TestERP5BankingMixin, ERP5TypeTestCase):
"""
......
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