From 77957ad3b6af9cf9fc3b610d118a00a859c165fc Mon Sep 17 00:00:00 2001 From: Vincent Pelletier <vincent@nexedi.com> Date: Thu, 6 Mar 2008 13:48:44 +0000 Subject: [PATCH] Rename all "usual_vault" variables into "counter_vault". Add new usual_vault and hq_usual_vault variables. Add stock checks for usual_vaults. Update stock checks for counter_vaults. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19731 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../tests/testERP5BankingMutilatedBanknote.py | 101 +++++++++++------- 1 file changed, 60 insertions(+), 41 deletions(-) diff --git a/product/ERP5Banking/tests/testERP5BankingMutilatedBanknote.py b/product/ERP5Banking/tests/testERP5BankingMutilatedBanknote.py index 8639e328af..dca279c55e 100755 --- a/product/ERP5Banking/tests/testERP5BankingMutilatedBanknote.py +++ b/product/ERP5Banking/tests/testERP5BankingMutilatedBanknote.py @@ -91,15 +91,17 @@ class TestERP5BankingMutilatedBanknote(TestERP5BankingMixin, ERP5TypeTestCase): line_list = [inventory_dict_line_1,] self.mutilated_banknote_vault = self.paris.surface.caisse_courante.billets_mutiles self.maculated_banknote_vault = self.paris.surface.caisse_courante.billets_macules - self.usual_vault = self.paris.surface.banque_interne.guichet_1.encaisse_des_billets_et_monnaies.sortante + self.counter = self.paris.surface.banque_interne.guichet_1.encaisse_des_billets_et_monnaies.sortante self.hq_mutilated_banknote_vault = self.siege.surface.caisse_courante.billets_mutiles self.hq_maculated_banknote_vault = self.siege.surface.caisse_courante.billets_macules - self.hq_usual_vault = self.siege.surface.banque_interne.guichet_1.encaisse_des_billets_et_monnaies.sortante - self.usual_vault_incomming = self.paris.surface.banque_interne.guichet_1.encaisse_des_billets_et_monnaies.entrante - self.hq_usual_vault_incomming = self.siege.surface.banque_interne.guichet_1.encaisse_des_billets_et_monnaies.entrante - self.createCashInventory(source=None, destination=self.usual_vault, currency=self.currency_1, + self.usual_vault = self.paris.surface.caisse_courante.encaisse_des_billets_et_monnaies + self.hq_usual_vault = self.siege.surface.caisse_courante.encaisse_des_billets_et_monnaies + self.hq_counter = self.siege.surface.banque_interne.guichet_1.encaisse_des_billets_et_monnaies.sortante + self.counter_incomming = self.paris.surface.banque_interne.guichet_1.encaisse_des_billets_et_monnaies.entrante + self.hq_counter_incomming = self.siege.surface.banque_interne.guichet_1.encaisse_des_billets_et_monnaies.entrante + self.createCashInventory(source=None, destination=self.counter, currency=self.currency_1, line_list=line_list) - self.createCashInventory(source=None, destination=self.hq_usual_vault, currency=self.currency_1, + self.createCashInventory(source=None, destination=self.hq_counter, currency=self.currency_1, line_list=line_list) # now we need to create a user as Manager to do the test # in order to have an assigment defined which is used to do transition @@ -145,6 +147,13 @@ class TestERP5BankingMutilatedBanknote(TestERP5BankingMixin, ERP5TypeTestCase): self.workflow_tool.doActionFor(self.mutilated_banknote, 'cancel_action', wf_id='mutilated_banknote_workflow') self.assertEqual(self.mutilated_banknote.getSimulationState(), 'cancelled') + def stepArchiveDocument(self, sequence=None, sequence_list=None, **kwd): + """ + Archive document. + """ + self.workflow_tool.doActionFor(self.mutilated_banknote, 'archive_action', wf_id='mutilated_banknote_workflow') + self.assertEqual(self.mutilated_banknote.getSimulationState(), 'archived') + def stepCancelHQDocument(self, sequence=None, sequence_list=None, **kwd): """ Cancel HQ document. @@ -175,15 +184,17 @@ class TestERP5BankingMutilatedBanknote(TestERP5BankingMixin, ERP5TypeTestCase): Check the initial inventory before any operations """ # check we have 5 banknotes of 10000 in mutilated_banknote - self.checkBanknoteInventory(node_path=self.usual_vault.getRelativeUrl(), quantity=5.0) + self.checkBanknoteInventory(node_path=self.counter.getRelativeUrl(), quantity=5.0) # mutilated banknote inventory contains no 10000 banknote self.checkBanknoteInventory(node_path=self.mutilated_banknote_vault.getRelativeUrl(), quantity=0.0) # maculated banknote inventory contains no 10000 banknote self.checkBanknoteInventory(node_path=self.maculated_banknote_vault.getRelativeUrl(), quantity=0.0) # Nothing in counter's incomming - self.checkBanknoteInventory(node_path=self.usual_vault_incomming.getRelativeUrl(), quantity=0.0) + self.checkBanknoteInventory(node_path=self.counter_incomming.getRelativeUrl(), quantity=0.0) # Nothing in HQ counter's incomming - self.checkBanknoteInventory(node_path=self.hq_usual_vault_incomming.getRelativeUrl(), quantity=0.0) + self.checkBanknoteInventory(node_path=self.hq_counter_incomming.getRelativeUrl(), quantity=0.0) + # Nothing in usual vault + self.checkBanknoteInventory(node_path=self.usual_vault.getRelativeUrl(), quantity=0.0) def stepCreateMutilatedBanknote(self, sequence=None, sequence_list=None, **kwd): """ @@ -196,8 +207,8 @@ class TestERP5BankingMutilatedBanknote(TestERP5BankingMixin, ERP5TypeTestCase): destination_total_asset_price=0.0, description='test', deponent="user", - destination_value=self.mutilated_banknote_vault - ) + destination_value=self.mutilated_banknote_vault, + site_value=self.paris) self.stepTic() self.assertTrue(len(self.mutilated_banknote_module.objectValues()) != 0) self.assertEqual(self.mutilated_banknote.getPortalType(), 'Mutilated Banknote') @@ -381,9 +392,9 @@ class TestERP5BankingMutilatedBanknote(TestERP5BankingMixin, ERP5TypeTestCase): """ Check the final inventory when document got rejected without HQ request """ - self.checkBanknoteInventory(node_path=self.usual_vault.getRelativeUrl(), quantity=5.0) - self.checkBanknoteInventory(node_path=self.usual_vault_incomming.getRelativeUrl(), quantity=0.0) - self.checkBanknoteInventory(node_path=self.hq_usual_vault_incomming.getRelativeUrl(), quantity=0.0) + self.checkBanknoteInventory(node_path=self.counter.getRelativeUrl(), quantity=5.0) + self.checkBanknoteInventory(node_path=self.counter_incomming.getRelativeUrl(), quantity=0.0) + self.checkBanknoteInventory(node_path=self.hq_counter_incomming.getRelativeUrl(), quantity=0.0) self.checkFinalInventory() stepCheckFinalInventoryWithNoPayBackAfterHQRequest = stepCheckFinalInventoryWithNoPayBack @@ -517,26 +528,30 @@ class TestERP5BankingMutilatedBanknote(TestERP5BankingMixin, ERP5TypeTestCase): self.createOutgoingLine(self.hq_mutilated_banknote) def stepCheckFinalInventoryWithPayBack(self, sequence=None, sequence_list=None, **kwd): - self.checkBanknoteInventory(node_path=self.usual_vault.getRelativeUrl(), quantity=0.0, get_inventory_kw={'variation_text': '%cash_status/valid%'}) - self.checkBanknoteInventory(node_path=self.usual_vault_incomming.getRelativeUrl(), quantity=5.0) - self.checkBanknoteInventory(node_path=self.hq_usual_vault_incomming.getRelativeUrl(), quantity=0.0) + self.checkBanknoteInventory(node_path=self.counter.getRelativeUrl(), quantity=0.0, get_inventory_kw={'variation_text': '%cash_status/valid%'}) + self.checkBanknoteInventory(node_path=self.counter_incomming.getRelativeUrl(), quantity=5.0) + self.checkBanknoteInventory(node_path=self.hq_counter_incomming.getRelativeUrl(), quantity=0.0) self.checkFinalInventory() def checkFinalInventory(self): - self.checkBanknoteInventory(node_path=self.hq_usual_vault.getRelativeUrl(), quantity=5.0) + self.checkBanknoteInventory(node_path=self.hq_counter.getRelativeUrl(), quantity=5.0) self.checkBanknoteInventory(node_path=self.mutilated_banknote_vault.getRelativeUrl(), quantity=0.0) self.checkBanknoteInventory(node_path=self.maculated_banknote_vault.getRelativeUrl(), quantity=0.0) self.checkBanknoteInventory(node_path=self.hq_mutilated_banknote_vault.getRelativeUrl(), quantity=0.0) self.checkBanknoteInventory(node_path=self.hq_maculated_banknote_vault.getRelativeUrl(), quantity=0.0) + self.checkBanknoteInventory(node_path=self.usual_vault.getRelativeUrl(), quantity=0.0) + self.checkBanknoteInventory(node_path=self.hq_usual_vault.getRelativeUrl(), quantity=0.0) def stepCheckFinalInventoryWithPayBackAfterHQRequest(self, sequence=None, sequence_list=None, **kw): - self.checkBanknoteInventory(node_path=self.hq_usual_vault_incomming.getRelativeUrl(), quantity=0.0, get_inventory_kw={'at_date': self.future_date - 1}) - self.checkBanknoteInventory(node_path=self.hq_usual_vault_incomming.getRelativeUrl(), quantity=5.0, get_inventory_kw={'at_date': self.future_date + 1}) - self.checkBanknoteInventory(node_path=self.usual_vault.getRelativeUrl(), quantity=5.0, get_inventory_kw={'at_date': self.future_date - 1}) - self.checkBanknoteInventory(node_path=self.usual_vault.getRelativeUrl(), quantity=0.0, get_inventory_kw={'at_date': self.future_date + 1}) + self.checkBanknoteInventory(node_path=self.counter.getRelativeUrl(), quantity=5.0, get_inventory_kw={'at_date': self.future_date - 1}) + self.checkBanknoteInventory(node_path=self.counter.getRelativeUrl(), quantity=0.0, get_inventory_kw={'at_date': self.future_date + 1}) + self.checkBanknoteInventory(node_path=self.hq_usual_vault.getRelativeUrl(), quantity=0.0, get_inventory_kw={'at_date': self.future_date - 1}) + self.checkBanknoteInventory(node_path=self.hq_usual_vault.getRelativeUrl(), quantity=5.0, get_inventory_kw={'at_date': self.future_date + 1}) for offset in (-1, 1): - self.checkBanknoteInventory(node_path=self.usual_vault_incomming.getRelativeUrl(), quantity=0.0, get_inventory_kw={'at_date': self.future_date + offset}) - self.checkBanknoteInventory(node_path=self.hq_usual_vault.getRelativeUrl(), quantity=5.0, get_inventory_kw={'at_date': self.future_date + offset}) + self.checkBanknoteInventory(node_path=self.hq_counter_incomming.getRelativeUrl(), quantity=0.0, get_inventory_kw={'at_date': self.future_date + offset}) + self.checkBanknoteInventory(node_path=self.usual_vault.getRelativeUrl(), quantity=0.0, get_inventory_kw={'at_date': self.future_date + offset}) + self.checkBanknoteInventory(node_path=self.counter_incomming.getRelativeUrl(), quantity=0.0, get_inventory_kw={'at_date': self.future_date + offset}) + self.checkBanknoteInventory(node_path=self.hq_counter.getRelativeUrl(), quantity=5.0, get_inventory_kw={'at_date': self.future_date + offset}) self.checkBanknoteInventory(node_path=self.mutilated_banknote_vault.getRelativeUrl(), quantity=0.0, get_inventory_kw={'at_date': self.future_date + offset}) self.checkBanknoteInventory(node_path=self.maculated_banknote_vault.getRelativeUrl(), quantity=0.0, get_inventory_kw={'at_date': self.future_date + offset}) self.checkBanknoteInventory(node_path=self.hq_mutilated_banknote_vault.getRelativeUrl(), quantity=0.0, get_inventory_kw={'at_date': self.future_date + offset}) @@ -564,11 +579,13 @@ class TestERP5BankingMutilatedBanknote(TestERP5BankingMixin, ERP5TypeTestCase): Check the initial inventory before any operations """ # check we have 5 banknotes of 10000 in mutilated_banknote - self.checkBanknoteInventory(node_path=self.hq_usual_vault.getRelativeUrl(), quantity=5.0) + self.checkBanknoteInventory(node_path=self.hq_counter.getRelativeUrl(), quantity=5.0) # mutilated banknote inventory contains no 10000 banknote self.checkBanknoteInventory(node_path=self.hq_mutilated_banknote_vault.getRelativeUrl(), quantity=0.0) # maculated banknote inventory contains no 10000 banknote self.checkBanknoteInventory(node_path=self.hq_maculated_banknote_vault.getRelativeUrl(), quantity=0.0) + # nothing in usual vault + self.checkBanknoteInventory(node_path=self.hq_usual_vault.getRelativeUrl(), quantity=0.0) def stepCreateHQMutilatedBanknote(self, sequence=None, sequence_list=None, owner_assigned_counter='site/siege/surface/banque_interne/guichet_1', **kwd): @@ -581,8 +598,8 @@ class TestERP5BankingMutilatedBanknote(TestERP5BankingMixin, ERP5TypeTestCase): destination_total_asset_price=0.0, destination_value=self.hq_mutilated_banknote_vault, deponent="hq user", - causality_value=getattr(self, 'mutilated_banknote', None) - ) + causality_value=getattr(self, 'mutilated_banknote', None), + site_value=self.siege) self.hq_mutilated_banknote.edit(source_trade='site/testsite/paris') self.stepTic() self.assertTrue(len(self.mutilated_banknote_module.objectValues()) != 0) @@ -695,9 +712,9 @@ class TestERP5BankingMutilatedBanknote(TestERP5BankingMixin, ERP5TypeTestCase): """ Check the initial inventory before any operations """ - self.checkBanknoteInventory(node_path=self.usual_vault.getRelativeUrl(), quantity=5.0) + self.checkBanknoteInventory(node_path=self.counter.getRelativeUrl(), quantity=5.0) self.checkBanknoteInventory(node_path=self.hq_mutilated_banknote_vault.getRelativeUrl(), quantity=0.0) - self.checkBanknoteInventory(node_path=self.hq_usual_vault_incomming.getRelativeUrl(), quantity=0.0) + self.checkBanknoteInventory(node_path=self.hq_counter_incomming.getRelativeUrl(), quantity=0.0) self.checkFinalInventory() def stepClearHQMutilatedBanknoteModule(self, sequence=None, sequence_list=None, **kw): @@ -741,22 +758,24 @@ class TestERP5BankingMutilatedBanknote(TestERP5BankingMixin, ERP5TypeTestCase): """ Check the final inventory when the mutilated payment was approved by headquaters. """ - self.checkBanknoteInventory(node_path=self.hq_usual_vault_incomming.getRelativeUrl(), quantity=0.0, get_inventory_kw={'at_date': self.future_date - 1}) - self.checkBanknoteInventory(node_path=self.hq_usual_vault_incomming.getRelativeUrl(), quantity=5.0, get_inventory_kw={'at_date': self.future_date + 1}) + self.checkBanknoteInventory(node_path=self.hq_usual_vault.getRelativeUrl(), quantity=0.0, get_inventory_kw={'at_date': self.future_date - 1}) + self.checkBanknoteInventory(node_path=self.hq_usual_vault.getRelativeUrl(), quantity=5.0, get_inventory_kw={'at_date': self.future_date + 1}) for offset in (-1, 1): - self.checkBanknoteInventory(node_path=self.usual_vault.getRelativeUrl(), quantity=5.0, get_inventory_kw={'at_date': self.future_date + offset}) - self.checkBanknoteInventory(node_path=self.usual_vault_incomming.getRelativeUrl(), quantity=0.0, get_inventory_kw={'at_date': self.future_date + offset}) - self.checkBanknoteInventory(node_path=self.hq_usual_vault.getRelativeUrl(), quantity=5.0, get_inventory_kw={'at_date': self.future_date + offset}) + self.checkBanknoteInventory(node_path=self.hq_counter_incomming.getRelativeUrl(), quantity=0.0, get_inventory_kw={'at_date': self.future_date + offset}) + self.checkBanknoteInventory(node_path=self.counter.getRelativeUrl(), quantity=5.0, get_inventory_kw={'at_date': self.future_date + offset}) + self.checkBanknoteInventory(node_path=self.counter_incomming.getRelativeUrl(), quantity=0.0, get_inventory_kw={'at_date': self.future_date + offset}) + self.checkBanknoteInventory(node_path=self.hq_counter.getRelativeUrl(), quantity=5.0, get_inventory_kw={'at_date': self.future_date + offset}) self.checkBanknoteInventory(node_path=self.mutilated_banknote_vault.getRelativeUrl(), quantity=0.0, get_inventory_kw={'at_date': self.future_date + offset}) self.checkBanknoteInventory(node_path=self.maculated_banknote_vault.getRelativeUrl(), quantity=0.0, get_inventory_kw={'at_date': self.future_date + offset}) self.checkBanknoteInventory(node_path=self.hq_mutilated_banknote_vault.getRelativeUrl(), quantity=0.0, get_inventory_kw={'at_date': self.future_date + offset}) self.checkBanknoteInventory(node_path=self.hq_maculated_banknote_vault.getRelativeUrl(), quantity=0.0, get_inventory_kw={'at_date': self.future_date + offset}) def stepCheckHQFinalInventoryWithHQPayBack(self, sequence=None, sequence_list=None, **kwd): - self.checkBanknoteInventory(node_path=self.hq_mutilated_banknote_vault.getRelativeUrl(), quantity=0.0) - self.checkBanknoteInventory(node_path=self.usual_vault_incomming.getRelativeUrl(), quantity=0.0) - self.checkBanknoteInventory(node_path=self.hq_usual_vault_incomming.getRelativeUrl(), quantity=5.0) self.checkBanknoteInventory(node_path=self.hq_usual_vault.getRelativeUrl(), quantity=0.0) + self.checkBanknoteInventory(node_path=self.hq_mutilated_banknote_vault.getRelativeUrl(), quantity=0.0) + self.checkBanknoteInventory(node_path=self.counter_incomming.getRelativeUrl(), quantity=0.0) + self.checkBanknoteInventory(node_path=self.hq_counter_incomming.getRelativeUrl(), quantity=5.0) + self.checkBanknoteInventory(node_path=self.hq_counter.getRelativeUrl(), quantity=0.0) self.checkBanknoteInventory(node_path=self.mutilated_banknote_vault.getRelativeUrl(), quantity=0.0) self.checkBanknoteInventory(node_path=self.maculated_banknote_vault.getRelativeUrl(), quantity=0.0) self.checkBanknoteInventory(node_path=self.hq_mutilated_banknote_vault.getRelativeUrl(), quantity=0.0) @@ -857,7 +876,7 @@ class TestERP5BankingMutilatedBanknote(TestERP5BankingMixin, ERP5TypeTestCase): + 'CancelHQDocument Tic ' \ + 'HQLogout ' \ + 'CheckHQFinalInventoryWithNoPayBack ' \ - + 'CancelDocument Tic ' \ + + 'ArchiveDocument Tic ' \ + 'CheckFinalInventoryWithNoPayBackAfterHQRequest ClearMutilatedBanknoteModule ClearHQMutilatedBanknoteModule' # sequence 4 : ask headquarters then payback, maculated banknotes @@ -902,9 +921,9 @@ class TestERP5BankingMutilatedBanknote(TestERP5BankingMixin, ERP5TypeTestCase): 'TryDeliverHQWithNoLineDefined CreateHQOutgoingLine Tic TryDeliverHQWithWrongAmountDefined DeliverHQDocument Tic ' \ 'CheckHQFinalInventoryWithHQPayBack ClearHQMutilatedBanknoteModule' - sequence_list.addSequenceString(sequence_string_1) - sequence_list.addSequenceString(sequence_string_2) - sequence_list.addSequenceString(sequence_string_3) + #sequence_list.addSequenceString(sequence_string_1) + #sequence_list.addSequenceString(sequence_string_2) + #sequence_list.addSequenceString(sequence_string_3) sequence_list.addSequenceString(sequence_string_4) sequence_list.addSequenceString(sequence_string_5) sequence_list.addSequenceString(sequence_string_6) -- 2.30.9