Commit 3c7dc789 authored by Sebastien Robin's avatar Sebastien Robin

changed unit test in order to follow new requests

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14611 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 28bc5bf3
...@@ -160,6 +160,7 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -160,6 +160,7 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase):
self.logout() self.logout()
self.login('super_user') self.login('super_user')
self.openCounterDate(site=self.paris) self.openCounterDate(site=self.paris)
self.openCounterDate(site=self.madrid, id='counter_date_2')
...@@ -228,6 +229,7 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -228,6 +229,7 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase):
source=self.vault_source.getRelativeUrl(), source=self.vault_source.getRelativeUrl(),
destination=self.vault_destination.getRelativeUrl(), destination=self.vault_destination.getRelativeUrl(),
description='test', description='test',
start_date=self.date,
source_total_asset_price=52400.0) source_total_asset_price=52400.0)
# execute tic # execute tic
self.stepTic() self.stepTic()
...@@ -370,7 +372,9 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -370,7 +372,9 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase):
# fix amount (10000 * 5.0 + 200 * 12.0 + 5000 * 24) # fix amount (10000 * 5.0 + 200 * 12.0 + 5000 * 24)
self.cash_movement.setSourceTotalAssetPrice('172400.0') self.cash_movement.setSourceTotalAssetPrice('172400.0')
# try to do the workflow action "stop_action', cath the exception ValidationFailed raised by workflow transition # try to do the workflow action "stop_action', cath the exception ValidationFailed raised by workflow transition
self.assertRaises(ValidationFailed, self.workflow_tool.doActionFor, self.cash_movement, 'stop_action', wf_id='cash_movement_workflow') self.assertRaises(ValidationFailed, self.workflow_tool.doActionFor,
self.cash_movement, 'stop_action',
wf_id='cash_movement_workflow', your_stop_date=self.date)
# execute tic # execute tic
self.stepTic() self.stepTic()
# get state of the cash_movement # get state of the cash_movement
...@@ -442,8 +446,10 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -442,8 +446,10 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase):
""" """
# fix amount (10000 * 5.0 + 200 * 12.0) # fix amount (10000 * 5.0 + 200 * 12.0)
self.cash_movement.setSourceTotalAssetPrice('52400.0') self.cash_movement.setSourceTotalAssetPrice('52400.0')
# do the Workflow action # do the Workflow action
self.workflow_tool.doActionFor(self.cash_movement, 'stop_action', wf_id='cash_movement_workflow') self.workflow_tool.doActionFor(self.cash_movement, 'stop_action',
wf_id='cash_movement_workflow', your_stop_date=self.date)
# execute tic # execute tic
self.stepTic() self.stepTic()
# get state # get state
......
...@@ -127,7 +127,7 @@ class TestERP5BankingCashToCurrencyPurchase(TestERP5BankingMixin, ERP5TypeTestCa ...@@ -127,7 +127,7 @@ class TestERP5BankingCashToCurrencyPurchase(TestERP5BankingMixin, ERP5TypeTestCa
line_list_sortante = [inventory_dict_line_1, inventory_dict_line_2] line_list_sortante = [inventory_dict_line_1, inventory_dict_line_2]
self.guichet_entrante = self.paris.surface.banque_interne.guichet_1.encaisse_des_devises.usd.entrante self.guichet_entrante = self.paris.surface.banque_interne.guichet_1.encaisse_des_devises.usd.sortante
self.guichet_sortante= self.paris.surface.banque_interne.guichet_1.encaisse_des_billets_et_monnaies.sortante self.guichet_sortante= self.paris.surface.banque_interne.guichet_1.encaisse_des_billets_et_monnaies.sortante
self.guichet = self.paris.surface.banque_interne.guichet_1 self.guichet = self.paris.surface.banque_interne.guichet_1
...@@ -273,7 +273,7 @@ class TestERP5BankingCashToCurrencyPurchase(TestERP5BankingMixin, ERP5TypeTestCa ...@@ -273,7 +273,7 @@ class TestERP5BankingCashToCurrencyPurchase(TestERP5BankingMixin, ERP5TypeTestCa
# check the source vault is encaisse_paris # check the source vault is encaisse_paris
self.assertEqual(cell.getBaobabSource(), None) self.assertEqual(cell.getBaobabSource(), None)
# check the destination vault is guichet_1 # check the destination vault is guichet_1
self.assertEqual(cell.getBaobabDestination(), 'site/testsite/paris/surface/banque_interne/guichet_1/encaisse_des_devises/usd/entrante') self.assertEqual(cell.getBaobabDestination(), 'site/testsite/paris/surface/banque_interne/guichet_1/encaisse_des_devises/usd/sortante')
if cell.getId() == 'movement_0_0_0': if cell.getId() == 'movement_0_0_0':
# check the quantity of banknote 20 # check the quantity of banknote 20
self.assertEqual(cell.getQuantity(), 5.0) self.assertEqual(cell.getQuantity(), 5.0)
......
...@@ -93,7 +93,7 @@ class TestERP5BankingCurrencyPurchase(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -93,7 +93,7 @@ class TestERP5BankingCurrencyPurchase(TestERP5BankingMixin, ERP5TypeTestCase):
self.bi_counter = self.paris.surface.banque_interne self.bi_counter = self.paris.surface.banque_interne
self.counter_site = self.paris.surface.banque_interne.guichet_1 self.counter_site = self.paris.surface.banque_interne.guichet_1
self.bi_counter_vault = self.paris.surface.banque_interne.guichet_1.encaisse_des_devises.usd.entrante self.bi_counter_vault = self.paris.surface.banque_interne.guichet_1.encaisse_des_devises.usd.sortante
self.stepTic() self.stepTic()
# create a person and a bank account # create a person and a bank account
self.person_1 = self.createPerson(id='person_1', self.person_1 = self.createPerson(id='person_1',
...@@ -292,7 +292,7 @@ class TestERP5BankingCurrencyPurchase(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -292,7 +292,7 @@ class TestERP5BankingCurrencyPurchase(TestERP5BankingMixin, ERP5TypeTestCase):
# check the source vault is encaisse_paris # check the source vault is encaisse_paris
self.assertEqual(cell.getBaobabSource(), None) self.assertEqual(cell.getBaobabSource(), None)
# check the destination vault is guichet_1 # check the destination vault is guichet_1
self.assertEqual(cell.getBaobabDestination(), 'site/testsite/paris/surface/banque_interne/guichet_1/encaisse_des_devises/usd/entrante') self.assertEqual(cell.getBaobabDestination(), 'site/testsite/paris/surface/banque_interne/guichet_1/encaisse_des_devises/usd/sortante')
def test_01_ERP5BankingCurrencyPurchase(self, quiet=QUIET, run=RUN_ALL_TEST): def test_01_ERP5BankingCurrencyPurchase(self, quiet=QUIET, run=RUN_ALL_TEST):
""" """
......
...@@ -297,7 +297,7 @@ class TestERP5BankingVaultTransfer(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -297,7 +297,7 @@ class TestERP5BankingVaultTransfer(TestERP5BankingMixin, ERP5TypeTestCase):
Create the vault transfer line 1 with banknotes of 10000 and check it has been well created Create the vault transfer line 1 with banknotes of 10000 and check it has been well created
""" """
# create the vault transfer line # create the vault transfer line
self.addCashLineToDelivery(self.vault_transfer, 'valid_line_1', 'Cash Delivery Line', self.billet_10000, self.addCashLineToDelivery(self.vault_transfer, 'valid_line_1', 'Vault Transfer Line', self.billet_10000,
('emission_letter', 'cash_status', 'variation'), ('emission_letter/p', 'cash_status/valid') + self.variation_list, ('emission_letter', 'cash_status', 'variation'), ('emission_letter/p', 'cash_status/valid') + self.variation_list,
self.quantity_10000) self.quantity_10000)
# execute tic # execute tic
...@@ -307,7 +307,7 @@ class TestERP5BankingVaultTransfer(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -307,7 +307,7 @@ class TestERP5BankingVaultTransfer(TestERP5BankingMixin, ERP5TypeTestCase):
# get the vault transfer line # get the vault transfer line
self.valid_line_1 = getattr(self.vault_transfer, 'valid_line_1') self.valid_line_1 = getattr(self.vault_transfer, 'valid_line_1')
# check its portal type # check its portal type
self.assertEqual(self.valid_line_1.getPortalType(), 'Cash Delivery Line') self.assertEqual(self.valid_line_1.getPortalType(), 'Vault Transfer Line')
# check the resource is banknotes of 10000 # check the resource is banknotes of 10000
self.assertEqual(self.valid_line_1.getResourceValue(), self.billet_10000) self.assertEqual(self.valid_line_1.getResourceValue(), self.billet_10000)
# chek the value of the banknote # chek the value of the banknote
...@@ -321,7 +321,7 @@ class TestERP5BankingVaultTransfer(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -321,7 +321,7 @@ class TestERP5BankingVaultTransfer(TestERP5BankingMixin, ERP5TypeTestCase):
# get the delivery cell # get the delivery cell
cell = self.valid_line_1.getCell('emission_letter/p', variation, 'cash_status/valid') cell = self.valid_line_1.getCell('emission_letter/p', variation, 'cash_status/valid')
# chek portal types # chek portal types
self.assertEqual(cell.getPortalType(), 'Cash Delivery Cell') self.assertEqual(cell.getPortalType(), 'Vault Transfer Cell')
# check the banknote of the cell is banknote of 10000 # check the banknote of the cell is banknote of 10000
self.assertEqual(cell.getResourceValue(), self.billet_10000) self.assertEqual(cell.getResourceValue(), self.billet_10000)
# check the source vault is usual_cash # check the source vault is usual_cash
...@@ -345,7 +345,7 @@ class TestERP5BankingVaultTransfer(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -345,7 +345,7 @@ class TestERP5BankingVaultTransfer(TestERP5BankingMixin, ERP5TypeTestCase):
Create the vault transfer line 1 with banknotes of 10000 and check it has been well created Create the vault transfer line 1 with banknotes of 10000 and check it has been well created
""" """
# create the vault transfer line # create the vault transfer line
self.addCashLineToDelivery(self.vault_transfer, 'valid_line_1', 'Cash Delivery Line', self.billet_10000, self.addCashLineToDelivery(self.vault_transfer, 'valid_line_1', 'Vault Transfer Line', self.billet_10000,
('emission_letter', 'cash_status', 'variation'), ('emission_letter/p', 'cash_status/valid') + self.variation_list, ('emission_letter', 'cash_status', 'variation'), ('emission_letter/p', 'cash_status/valid') + self.variation_list,
self.quantity_10000) self.quantity_10000)
# execute tic # execute tic
...@@ -355,7 +355,7 @@ class TestERP5BankingVaultTransfer(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -355,7 +355,7 @@ class TestERP5BankingVaultTransfer(TestERP5BankingMixin, ERP5TypeTestCase):
# get the vault transfer line # get the vault transfer line
self.valid_line_1 = getattr(self.vault_transfer, 'valid_line_1') self.valid_line_1 = getattr(self.vault_transfer, 'valid_line_1')
# check its portal type # check its portal type
self.assertEqual(self.valid_line_1.getPortalType(), 'Cash Delivery Line') self.assertEqual(self.valid_line_1.getPortalType(), 'Vault Transfer Line')
# check the resource is banknotes of 10000 # check the resource is banknotes of 10000
self.assertEqual(self.valid_line_1.getResourceValue(), self.billet_10000) self.assertEqual(self.valid_line_1.getResourceValue(), self.billet_10000)
# chek the value of the banknote # chek the value of the banknote
...@@ -369,7 +369,7 @@ class TestERP5BankingVaultTransfer(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -369,7 +369,7 @@ class TestERP5BankingVaultTransfer(TestERP5BankingMixin, ERP5TypeTestCase):
# get the delivery cell # get the delivery cell
cell = self.valid_line_1.getCell('emission_letter/p', variation, 'cash_status/valid') cell = self.valid_line_1.getCell('emission_letter/p', variation, 'cash_status/valid')
# chek portal types # chek portal types
self.assertEqual(cell.getPortalType(), 'Cash Delivery Cell') self.assertEqual(cell.getPortalType(), 'Vault Transfer Cell')
# check the banknote of the cell is banknote of 10000 # check the banknote of the cell is banknote of 10000
self.assertEqual(cell.getResourceValue(), self.billet_10000) self.assertEqual(cell.getResourceValue(), self.billet_10000)
# check the source vault is usual_cash # check the source vault is usual_cash
...@@ -402,7 +402,7 @@ class TestERP5BankingVaultTransfer(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -402,7 +402,7 @@ class TestERP5BankingVaultTransfer(TestERP5BankingMixin, ERP5TypeTestCase):
Create the vault transfer line 2 wiht coins of 200 and check it has been well created Create the vault transfer line 2 wiht coins of 200 and check it has been well created
""" """
# create the line # create the line
self.addCashLineToDelivery(self.vault_transfer, 'valid_line_2', 'Cash Delivery Line', self.piece_200, self.addCashLineToDelivery(self.vault_transfer, 'valid_line_2', 'Vault Transfer Line', self.piece_200,
('emission_letter', 'cash_status', 'variation'), ('emission_letter/p', 'cash_status/valid') + self.variation_list, ('emission_letter', 'cash_status', 'variation'), ('emission_letter/p', 'cash_status/valid') + self.variation_list,
self.quantity_200) self.quantity_200)
# execute tic # execute tic
...@@ -412,7 +412,7 @@ class TestERP5BankingVaultTransfer(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -412,7 +412,7 @@ class TestERP5BankingVaultTransfer(TestERP5BankingMixin, ERP5TypeTestCase):
# get the second vault transfer line # get the second vault transfer line
self.valid_line_2 = getattr(self.vault_transfer, 'valid_line_2') self.valid_line_2 = getattr(self.vault_transfer, 'valid_line_2')
# check portal types # check portal types
self.assertEqual(self.valid_line_2.getPortalType(), 'Cash Delivery Line') self.assertEqual(self.valid_line_2.getPortalType(), 'Vault Transfer Line')
# check the resource is coin of 200 # check the resource is coin of 200
self.assertEqual(self.valid_line_2.getResourceValue(), self.piece_200) self.assertEqual(self.valid_line_2.getResourceValue(), self.piece_200)
# check the value of coin # check the value of coin
...@@ -425,7 +425,7 @@ class TestERP5BankingVaultTransfer(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -425,7 +425,7 @@ class TestERP5BankingVaultTransfer(TestERP5BankingMixin, ERP5TypeTestCase):
# get the delivery cell # get the delivery cell
cell = self.valid_line_2.getCell('emission_letter/p', variation, 'cash_status/valid') cell = self.valid_line_2.getCell('emission_letter/p', variation, 'cash_status/valid')
# check the portal type # check the portal type
self.assertEqual(cell.getPortalType(), 'Cash Delivery Cell') self.assertEqual(cell.getPortalType(), 'Vault Transfer Cell')
if cell.getId() == 'movement_0_0_0': if cell.getId() == 'movement_0_0_0':
# check the quantity for coin for year 1992 is 5 # check the quantity for coin for year 1992 is 5
self.assertEqual(cell.getQuantity(), 5.0) self.assertEqual(cell.getQuantity(), 5.0)
...@@ -443,7 +443,7 @@ class TestERP5BankingVaultTransfer(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -443,7 +443,7 @@ class TestERP5BankingVaultTransfer(TestERP5BankingMixin, ERP5TypeTestCase):
""" """
# create a line in which quanity of banknotes of 5000 is higher that quantity available at source # create a line in which quanity of banknotes of 5000 is higher that quantity available at source
# here create a line with 24 (11+13) banknotes of 500 although the vault usual_cash has no banknote of 5000 # here create a line with 24 (11+13) banknotes of 500 although the vault usual_cash has no banknote of 5000
self.addCashLineToDelivery(self.vault_transfer, 'invalid_line', 'Cash Delivery Line', self.billet_5000, self.addCashLineToDelivery(self.vault_transfer, 'invalid_line', 'Vault Transfer Line', self.billet_5000,
('emission_letter', 'cash_status', 'variation'), ('emission_letter/p', 'cash_status/valid') + self.variation_list, ('emission_letter', 'cash_status', 'variation'), ('emission_letter/p', 'cash_status/valid') + self.variation_list,
self.quantity_5000) self.quantity_5000)
# execute tic # execute tic
...@@ -663,7 +663,7 @@ class TestERP5BankingVaultTransfer(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -663,7 +663,7 @@ class TestERP5BankingVaultTransfer(TestERP5BankingMixin, ERP5TypeTestCase):
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.vault_transfer, 'confirm_to_deliver_action', wf_id='vault_transfer_workflow') self.workflow_tool.doActionFor(self.vault_transfer, 'deliver_action', wf_id='vault_transfer_workflow')
# execute tic # execute tic
self.stepTic() self.stepTic()
# get state of vault_transfer # get state of vault_transfer
...@@ -751,7 +751,7 @@ class TestERP5BankingVaultTransfer(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -751,7 +751,7 @@ class TestERP5BankingVaultTransfer(TestERP5BankingMixin, ERP5TypeTestCase):
Try if we get Insufficient balance Try if we get Insufficient balance
""" """
message = self.assertWorkflowTransitionFails(self.vault_transfer, message = self.assertWorkflowTransitionFails(self.vault_transfer,
'vault_transfer_workflow','confirm_to_deliver_action') 'vault_transfer_workflow','deliver_action')
self.failUnless(message.find('Insufficient balance')>=0) self.failUnless(message.find('Insufficient balance')>=0)
################################## ##################################
...@@ -777,12 +777,12 @@ class TestERP5BankingVaultTransfer(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -777,12 +777,12 @@ class TestERP5BankingVaultTransfer(TestERP5BankingMixin, ERP5TypeTestCase):
+ 'CheckSourceDebitPlanned CheckDestinationCreditPlanned ' \ + 'CheckSourceDebitPlanned CheckDestinationCreditPlanned ' \
+ 'CheckSourceDebitPlanned CheckDestinationCreditPlanned ' \ + 'CheckSourceDebitPlanned CheckDestinationCreditPlanned ' \
+ 'OrderVaultTransfer ' \ + 'OrderVaultTransfer ' \
+ 'ConfirmVaultTransfer ' \
+ 'ResetSourceInventory Tic ' \ + 'ResetSourceInventory Tic ' \
+ 'DeliverVaultTransferFails Tic ' \ + 'DeliverVaultTransferFails Tic ' \
+ 'DeleteResetInventory Tic ' \ + 'DeleteResetInventory Tic ' \
+ 'ConfirmToDeliverVaultTransfer ' \ + 'ConfirmToDeliverVaultTransfer ' \
+ 'CheckSourceDebit CheckDestinationCredit ' + 'CheckSourceDebit CheckDestinationCredit '
#+ 'ConfirmVaultTransfer ' \
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(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