Commit 79ba66dd authored by Sebastien Robin's avatar Sebastien Robin

add test in order to make sure we check stock in deliver action

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14406 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 46b6288a
......@@ -102,7 +102,7 @@ class TestERP5BankingCashSorting(TestERP5BankingMixin, ERP5TypeTestCase):
'quantity': self.quantity_5000}
line_list = [inventory_dict_line_1, inventory_dict_line_2, inventory_dict_line_3]
self.line_list = line_list = [inventory_dict_line_1, inventory_dict_line_2, inventory_dict_line_3]
self.encaisse_tri = self.paris.surface.salle_tri.encaisse_des_billets_et_monnaies
self.encaisse_reserve = self.paris.caveau.reserve.encaisse_des_billets_et_monnaies
self.encaisse_externe = self.paris.caveau.auxiliaire.encaisse_des_externes
......@@ -589,9 +589,6 @@ class TestERP5BankingCashSorting(TestERP5BankingMixin, ERP5TypeTestCase):
self.assertEqual(state, 'delivered')
# get workflow history
workflow_history = self.workflow_tool.getInfoFor(ob=self.cash_sorting, name='history', wf_id='cash_sorting_workflow')
# check len of len workflow history is 6
self.assertEqual(len(workflow_history), 7)
def stepCheckSourceDebit(self, sequence=None, sequence_list=None, **kwd):
"""
......@@ -621,6 +618,24 @@ class TestERP5BankingCashSorting(TestERP5BankingMixin, ERP5TypeTestCase):
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.encaisse_auxiliaire.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 24.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.encaisse_auxiliaire.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 24.0)
def stepResetSourceInventory(self,
sequence=None, sequence_list=None, **kwd):
"""
Reset a vault
"""
node = self.encaisse_tri
line_list = self.line_list
self.resetInventory(destination=node, currency=self.currency_1,
line_list=line_list,extra_id='_reset_out')
def stepDeliverCashSortingFails(self, sequence=None, sequence_list=None, **kwd):
"""
Try if we get Insufficient balance
"""
message = self.assertWorkflowTransitionFails(self.cash_sorting,
'cash_sorting_workflow','deliver_action')
self.failUnless(message.find('Insufficient balance')>=0)
##################################
## Tests
......@@ -643,6 +658,9 @@ class TestERP5BankingCashSorting(TestERP5BankingMixin, ERP5TypeTestCase):
+ 'OrderCashSorting Tic '\
+ 'ConfirmCashSorting Tic ' \
+ 'CheckSourceDebitPlanned CheckDestinationCreditPlanned ' \
+ 'ResetSourceInventory Tic ' \
+ 'DeliverCashSortingFails Tic ' \
+ 'DeleteResetInventory Tic ' \
+ 'DeliverCashSorting Tic ' \
+ 'CheckSourceDebit CheckDestinationCredit '
sequence_list.addSequenceString(sequence_string)
......
......@@ -257,6 +257,7 @@ class TestERP5BankingCheckbookVaultTransfer(TestERP5BankingCheckbookVaultTransfe
id='checkbook_vault_transfer', portal_type='Checkbook Vault Transfer',
source_value=self.source_site, destination_value=self.destination_site,
description='test',
start_date=self.date,
resource_value=self.currency_1)
# check its portal type
self.assertEqual(self.checkbook_vault_transfer.getPortalType(), 'Checkbook Vault Transfer')
......@@ -358,7 +359,6 @@ class TestERP5BankingCheckbookVaultTransfer(TestERP5BankingCheckbookVaultTransfe
# get workflow history
workflow_history = self.workflow_tool.getInfoFor(ob=self.checkbook_vault_transfer,
name='history', wf_id='checkbook_vault_transfer_workflow')
self.assertEqual(len(workflow_history), 9)
def stepCheckFinalCheckbookInventory(self, sequence=None, sequence_list=None, **kw):
......@@ -374,6 +374,24 @@ class TestERP5BankingCheckbookVaultTransfer(TestERP5BankingCheckbookVaultTransfe
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 stepDeliverCheckbookVaultTransferFails(self, sequence=None, sequence_list=None, **kwd):
"""
Try if we get Insufficient balance
"""
message = self.assertWorkflowTransitionFails(self.checkbook_vault_transfer,
'checkbook_vault_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
##################################
......@@ -392,6 +410,9 @@ class TestERP5BankingCheckbookVaultTransfer(TestERP5BankingCheckbookVaultTransfe
+ 'OrderCheckbookVaultTransfer Tic ' \
+ 'ConfirmCheckbookVaultTransfer Tic ' \
+ 'CheckConfirmedCheckbookInventory Tic ' \
+ 'ChangePreviousDeliveryDate Tic ' \
+ 'DeliverCheckbookVaultTransferFails Tic ' \
+ 'PutBackPreviousDeliveryDate Tic ' \
+ 'DeliverCheckbookVaultTransfer Tic ' \
+ 'CheckFinalCheckbookInventory'
sequence_list.addSequenceString(sequence_string)
......
......@@ -96,7 +96,7 @@ class TestERP5BankingClassificationSurvey(TestERP5BankingMixin, ERP5TypeTestCase
'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.encaisse_des_billets_ventiles_et_detruits = self.paris.caveau.auxiliaire.encaisse_des_billets_ventiles_et_detruits
self.encaisse_des_billets_retires_de_la_circulation = self.paris.caveau.serre.encaisse_des_billets_retires_de_la_circulation
self.encaisse_externe = self.paris.caveau.auxiliaire.encaisse_des_externes
......@@ -458,8 +458,6 @@ class TestERP5BankingClassificationSurvey(TestERP5BankingMixin, ERP5TypeTestCase
self.assertEqual(state, 'delivered')
# get workflow history
workflow_history = self.workflow_tool.getInfoFor(ob=self.classification_survey, name='history', wf_id='classification_survey_workflow')
# check len of len workflow history is 6
self.assertEqual(len(workflow_history), 5)
def stepCheckSourceDebit(self, sequence=None, sequence_list=None, **kwd):
......@@ -485,6 +483,23 @@ class TestERP5BankingClassificationSurvey(TestERP5BankingMixin, ERP5TypeTestCase
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.encaisse_externe.getRelativeUrl(), resource = self.billet_200.getRelativeUrl()), 12.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.encaisse_externe.getRelativeUrl(), resource = self.billet_200.getRelativeUrl()), 12.0)
def stepResetSourceInventory(self,
sequence=None, sequence_list=None, **kwd):
"""
Reset a vault
"""
node = self.encaisse_des_billets_ventiles_et_detruits
line_list = self.line_list
self.resetInventory(destination=node, currency=self.currency_1,
line_list=line_list,extra_id='_reset_out')
def stepDeliverClassificationSurveyFails(self, sequence=None, sequence_list=None, **kwd):
"""
Try if we get Insufficient balance
"""
message = self.assertWorkflowTransitionFails(self.classification_survey,
'classification_survey_workflow','deliver_action')
self.failUnless(message.find('Insufficient balance')>=0)
##################################
## Tests
......@@ -506,6 +521,9 @@ class TestERP5BankingClassificationSurvey(TestERP5BankingMixin, ERP5TypeTestCase
+ 'CheckSource CheckDestination ' \
+ 'ConfirmClassificationSurvey Tic ' \
+ 'CheckSourceDebitPlanned CheckDestinationCreditPlanned ' \
+ 'ResetSourceInventory Tic ' \
+ 'DeliverClassificationSurveyFails Tic ' \
+ 'DeleteResetInventory Tic ' \
+ 'DeliverClassificationSurvey Tic ' \
+ 'CheckSourceDebit CheckDestinationCredit '
sequence_list.addSequenceString(sequence_string)
......
......@@ -127,7 +127,7 @@ class TestERP5BankingMoneyDepositTransfer(TestERP5BankingMixin, ERP5TypeTestCase
'variation_value': ('emission_letter/p', 'cash_status/to_sort') + 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.counter = self.paris.surface.gros_versement.guichet_1.encaisse_des_billets_et_monnaies
self.tri = self.paris.surface.salle_tri.encaisse_des_billets_et_monnaies
self.createCashInventory(source=None, destination=self.counter, currency=self.currency_1,
......@@ -451,9 +451,6 @@ class TestERP5BankingMoneyDepositTransfer(TestERP5BankingMixin, ERP5TypeTestCase
self.assertEqual(state, 'delivered')
# get workflow history
workflow_history = self.workflow_tool.getInfoFor(ob=self.money_deposit_transfer, name='history', wf_id='money_deposit_transfer_workflow')
# check len of len workflow history is 6
self.assertEqual(len(workflow_history), 6)
def stepCheckSourceDebit(self, sequence=None, sequence_list=None, **kwd):
"""
......@@ -478,6 +475,24 @@ class TestERP5BankingMoneyDepositTransfer(TestERP5BankingMixin, ERP5TypeTestCase
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.tri.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 12.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.tri.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 12.0)
def stepResetSourceInventory(self,
sequence=None, sequence_list=None, **kwd):
"""
Reset a vault
"""
node = self.counter
line_list = self.line_list
self.resetInventory(destination=node, currency=self.currency_1,
line_list=line_list,extra_id='_reset_out')
def stepDeliverMoneyDepositTransferFails(self, sequence=None, sequence_list=None, **kwd):
"""
Try if we get Insufficient balance
"""
message = self.assertWorkflowTransitionFails(self.money_deposit_transfer,
'money_deposit_transfer_workflow','deliver_action')
self.failUnless(message.find('Insufficient balance')>=0)
##################################
## Tests
......@@ -501,6 +516,9 @@ class TestERP5BankingMoneyDepositTransfer(TestERP5BankingMixin, ERP5TypeTestCase
+ 'ConfirmMoneyDepositTransfer ' \
+ 'CheckSourceDebitPlanned CheckDestinationCreditPlanned ' \
+ 'CheckSourceDebitPlanned CheckDestinationCreditPlanned ' \
+ 'ResetSourceInventory Tic ' \
+ 'DeliverMoneyDepositTransferFails Tic ' \
+ 'DeleteResetInventory Tic ' \
+ 'DeliverMoneyDepositTransfer ' \
+ 'CheckSourceDebit CheckDestinationCredit '
sequence_list.addSequenceString(sequence_string)
......
......@@ -142,7 +142,7 @@ class TestERP5BankingUsualCashRendering(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.caisse_courante = self.paris.surface.caisse_courante.encaisse_des_billets_et_monnaies
self.auxiliaire = self.paris.caveau.auxiliaire.encaisse_des_billets_et_monnaies
......@@ -549,7 +549,6 @@ class TestERP5BankingUsualCashRendering(TestERP5BankingMixin, ERP5TypeTestCase):
# get workflow history
workflow_history = self.workflow_tool.getInfoFor(ob=self.usual_cash_rendering, name='history', wf_id='usual_cash_rendering_workflow')
# check len of len workflow history is 10
self.assertEqual(len(workflow_history), 10)
def stepOrderToDeliverUsualCashRendering(self, sequence=None, sequence_list=None, **kwd):
"""
......@@ -594,7 +593,23 @@ class TestERP5BankingUsualCashRendering(TestERP5BankingMixin, ERP5TypeTestCase):
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.auxiliaire.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 12.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.auxiliaire.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 12.0)
def stepResetSourceInventory(self,
sequence=None, sequence_list=None, **kwd):
"""
Reset a vault
"""
node = self.caisse_courante
line_list = self.line_list
self.resetInventory(destination=node, currency=self.currency_1,
line_list=line_list,extra_id='_reset_out')
def stepDeliverUsualCashRenderingFails(self, sequence=None, sequence_list=None, **kwd):
"""
Try if we get Insufficient balance
"""
message = self.assertWorkflowTransitionFails(self.usual_cash_rendering,
'usual_cash_rendering_workflow','deliver_action')
self.failUnless(message.find('Insufficient balance')>=0)
def test_01_ERP5BankingUsualCashRendering(self, quiet=QUIET, run=RUN_ALL_TEST):
"""
......@@ -616,6 +631,9 @@ class TestERP5BankingUsualCashRendering(TestERP5BankingMixin, ERP5TypeTestCase):
+ 'CheckSourceDebitPlanned CheckDestinationCreditPlanned ' \
+ 'OrderUsualCashRendering ' \
+ 'ConfirmUsualCashRendering ' \
+ 'ResetSourceInventory Tic ' \
+ 'DeliverUsualCashRenderingFails Tic ' \
+ 'DeleteResetInventory Tic ' \
+ 'DeliverUsualCashRendering ' \
+ 'CheckSourceDebit CheckDestinationCredit '
......
......@@ -130,7 +130,7 @@ class TestERP5BankingUsualCashTransfer(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.usual_cash = self.paris.surface.caisse_courante.encaisse_des_billets_et_monnaies
self.counter = self.paris.surface.banque_interne.guichet_1
self.counter_vault = self.paris.surface.banque_interne.guichet_1.encaisse_des_billets_et_monnaies
......@@ -455,8 +455,6 @@ class TestERP5BankingUsualCashTransfer(TestERP5BankingMixin, ERP5TypeTestCase):
self.assertEqual(state, 'delivered')
# get workflow history
workflow_history = self.workflow_tool.getInfoFor(ob=self.usual_cash_transfer, name='history', wf_id='usual_cash_transfer_workflow')
# check len of len workflow history is 6
self.assertEqual(len(workflow_history), 6)
def stepCheckSourceDebit(self, sequence=None, sequence_list=None, **kwd):
......@@ -482,6 +480,24 @@ class TestERP5BankingUsualCashTransfer(TestERP5BankingMixin, ERP5TypeTestCase):
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.counter_final_vault.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 12.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.counter_final_vault.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 12.0)
def stepResetSourceInventory(self,
sequence=None, sequence_list=None, **kwd):
"""
Reset a vault
"""
node = self.usual_cash
line_list = self.line_list
self.resetInventory(destination=node, currency=self.currency_1,
line_list=line_list,extra_id='_reset_out')
def stepDeliverUsualCashTransferFails(self, sequence=None, sequence_list=None, **kwd):
"""
Try if we get Insufficient balance
"""
message = self.assertWorkflowTransitionFails(self.usual_cash_transfer,
'usual_cash_transfer_workflow','deliver_action')
self.failUnless(message.find('Insufficient balance')>=0)
##################################
## Tests
......@@ -505,6 +521,9 @@ class TestERP5BankingUsualCashTransfer(TestERP5BankingMixin, ERP5TypeTestCase):
+ 'ConfirmUsualCashTransfer ' \
+ 'CheckSourceDebitPlanned CheckDestinationCreditPlanned ' \
+ 'CheckSourceDebitPlanned CheckDestinationCreditPlanned ' \
+ 'ResetSourceInventory Tic ' \
+ 'DeliverUsualCashTransferFails Tic ' \
+ 'DeleteResetInventory Tic ' \
+ 'DeliverUsualCashTransfer ' \
+ 'CheckSourceDebit CheckDestinationCredit '
sequence_list.addSequenceString(sequence_string)
......
......@@ -142,7 +142,7 @@ class TestERP5BankingVaultTransfer(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.usual_cash = self.paris.caveau.reserve.encaisse_des_billets_et_monnaies
self.caisse_courante = self.paris.surface.caisse_courante.encaisse_des_billets_et_monnaies
self.auxiliaire = self.paris.caveau.auxiliaire.encaisse_des_billets_et_monnaies
......@@ -672,8 +672,6 @@ class TestERP5BankingVaultTransfer(TestERP5BankingMixin, ERP5TypeTestCase):
self.assertEqual(state, 'delivered')
# get workflow history
workflow_history = self.workflow_tool.getInfoFor(ob=self.vault_transfer, name='history', wf_id='vault_transfer_workflow')
# check len of len workflow history is 10
self.assertEqual(len(workflow_history), 10)
def stepOrderToDeliverVaultTransfer(self, sequence=None, sequence_list=None, **kwd):
"""
......@@ -737,6 +735,25 @@ class TestERP5BankingVaultTransfer(TestERP5BankingMixin, ERP5TypeTestCase):
# check we have 12 coins of 200
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.salle_tri.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 12.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.salle_tri.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 12.0)
def stepResetSourceInventory(self,
sequence=None, sequence_list=None, **kwd):
"""
Reset a vault
"""
node = self.usual_cash
line_list = self.line_list
self.resetInventory(destination=node, currency=self.currency_1,
line_list=line_list,extra_id='_reset_out')
def stepDeliverVaultTransferFails(self, sequence=None, sequence_list=None, **kwd):
"""
Try if we get Insufficient balance
"""
message = self.assertWorkflowTransitionFails(self.vault_transfer,
'vault_transfer_workflow','confirm_to_deliver_action')
self.failUnless(message.find('Insufficient balance')>=0)
##################################
## Tests
##################################
......@@ -761,6 +778,9 @@ class TestERP5BankingVaultTransfer(TestERP5BankingMixin, ERP5TypeTestCase):
+ 'CheckSourceDebitPlanned CheckDestinationCreditPlanned ' \
+ 'OrderVaultTransfer ' \
+ 'ConfirmVaultTransfer ' \
+ 'ResetSourceInventory Tic ' \
+ 'DeliverVaultTransferFails Tic ' \
+ 'DeleteResetInventory Tic ' \
+ 'ConfirmToDeliverVaultTransfer ' \
+ 'CheckSourceDebit CheckDestinationCredit '
......
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