Commit ac8a15e2 authored by Sebastien Robin's avatar Sebastien Robin

change tests in order to take into account new way of checking references of checks

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14559 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4d230b5a
...@@ -796,14 +796,15 @@ class TestERP5BankingMixin: ...@@ -796,14 +796,15 @@ class TestERP5BankingMixin:
reference_range_max = max, reference_range_max = max,
start_date = date) start_date = date)
def createCheckbookModel(self, id): def createCheckbookModel(self, id, check_model):
""" """
Create a checkbook for the given bank account Create a checkbook for the given bank account
with 3 variations with 3 variations
""" """
model = self.checkbook_model_module.newContent(id = id, model = self.checkbook_model_module.newContent(id = id,
portal_type = 'Checkbook Model', portal_type = 'Checkbook Model',
title='Generic') title='Generic',
composition=check_model.getRelativeUrl())
model.newContent(id='variant_1',portal_type='Checkbook Model Check Amount Variation', model.newContent(id='variant_1',portal_type='Checkbook Model Check Amount Variation',
quantity=50,title='50') quantity=50,title='50')
model.newContent(id='variant_2',portal_type='Checkbook Model Check Amount Variation', model.newContent(id='variant_2',portal_type='Checkbook Model Check Amount Variation',
...@@ -822,14 +823,16 @@ class TestERP5BankingMixin: ...@@ -822,14 +823,16 @@ class TestERP5BankingMixin:
title = 'Check', title = 'Check',
) )
def createCheck(self, id, reference, checkbook,bank_account=None): def createCheck(self, id, reference, checkbook, bank_account=None,
resource_value=None):
""" """
Create Check in a checkbook Create Check in a checkbook
""" """
check = checkbook.newContent(id=id, check = checkbook.newContent(id=id,
portal_type = 'Check', portal_type = 'Check',
reference=reference, reference=reference,
destination_payment_value=bank_account destination_payment_value=bank_account,
resource_value=resource_value
) )
# mark the check as issued # mark the check as issued
......
...@@ -140,6 +140,8 @@ class TestERP5BankingCheckPaymentMixin: ...@@ -140,6 +140,8 @@ class TestERP5BankingCheckPaymentMixin:
self.openCounterDate(site=self.paris) self.openCounterDate(site=self.paris)
self.openCounter(site=self.bi_counter_vault) self.openCounter(site=self.bi_counter_vault)
self.check_model = self.createCheckModel(id='check_model')
self.createCheckbookModel(id='checkbook_model', check_model=self.check_model)
# create a check # create a check
self.checkbook_1 = self.createCheckbook(id= 'checkbook_1', self.checkbook_1 = self.createCheckbook(id= 'checkbook_1',
vault=self.bi_counter, vault=self.bi_counter,
...@@ -150,24 +152,29 @@ class TestERP5BankingCheckPaymentMixin: ...@@ -150,24 +152,29 @@ class TestERP5BankingCheckPaymentMixin:
self.check_1 = self.createCheck(id='check_1', self.check_1 = self.createCheck(id='check_1',
reference='50', reference='50',
resource_value=self.check_model,
checkbook=self.checkbook_1) checkbook=self.checkbook_1)
self.check_2 = self.createCheck(id='check_2', self.check_2 = self.createCheck(id='check_2',
reference='51', reference='51',
resource_value=self.check_model,
checkbook=self.checkbook_1) checkbook=self.checkbook_1)
self.check_3 = self.createCheck(id='check_3', self.check_3 = self.createCheck(id='check_3',
reference='52', reference='52',
resource_value=self.check_model,
checkbook=self.checkbook_1) checkbook=self.checkbook_1)
self.check_4 = self.createCheck(id='check_4', self.check_4 = self.createCheck(id='check_4',
reference='53', reference='53',
resource_value=self.check_model,
checkbook=self.checkbook_1) checkbook=self.checkbook_1)
self.check_5 = self.createCheck(id='check_5', self.check_5 = self.createCheck(id='check_5',
reference='54', reference='54',
resource_value=self.check_model,
checkbook=self.checkbook_1) checkbook=self.checkbook_1)
self.check_5 = self.createCheck(id='check_6', self.check_5 = self.createCheck(id='check_6',
reference='56', reference='56',
resource_value=self.check_model,
checkbook=self.checkbook_1) checkbook=self.checkbook_1)
self.non_existant_check_reference = '55' self.non_existant_check_reference = '55'
self.createCheckbookModel(id='checkbook_model')
def stepCheckObjects(self, sequence=None, sequence_list=None, **kwd): def stepCheckObjects(self, sequence=None, sequence_list=None, **kwd):
""" """
...@@ -205,11 +212,13 @@ class TestERP5BankingCheckPaymentMixin: ...@@ -205,11 +212,13 @@ class TestERP5BankingCheckPaymentMixin:
""" """
Create a check payment document and check it Create a check payment document and check it
""" """
self.check_payment = self.check_payment_module.newContent(id = 'check_payment', portal_type = 'Check Payment', self.check_payment = self.check_payment_module.newContent(id = 'check_payment',
portal_type = 'Check Payment',
destination_payment_value = self.bank_account_1, destination_payment_value = self.bank_account_1,
# aggregate_value = self.check_1, # aggregate_value = self.check_1,
resource_value = self.currency_1, resource_value = self.currency_1,
aggregate_free_text = "50", aggregate_free_text = "50",
aggregate_resource_value = self.check_model,
description = "test", description = "test",
# source_value = self.bi_counter, # source_value = self.bi_counter,
start_date = DateTime().Date(), start_date = DateTime().Date(),
...@@ -264,10 +273,9 @@ class TestERP5BankingCheckPaymentMixin: ...@@ -264,10 +273,9 @@ class TestERP5BankingCheckPaymentMixin:
insuffisient_balance=0, **kwd): insuffisient_balance=0, **kwd):
new_payment = self.check_payment_module.newContent(portal_type = 'Check Payment', new_payment = self.check_payment_module.newContent(portal_type = 'Check Payment',
destination_payment_value = self.bank_account_1, destination_payment_value = self.bank_account_1,
# aggregate_value = self.check_1,
resource_value = self.currency_1, resource_value = self.currency_1,
aggregate_resource_value = self.check_model,
aggregate_free_text = number, aggregate_free_text = number,
# source_value = self.bi_counter,
start_date = DateTime().Date(), start_date = DateTime().Date(),
source_total_asset_price = 20000.0) source_total_asset_price = 20000.0)
new_payment._setSource(self.bi_counter.getRelativeUrl()) new_payment._setSource(self.bi_counter.getRelativeUrl())
......
...@@ -85,8 +85,9 @@ class TestERP5BankingCheckbookReception(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -85,8 +85,9 @@ class TestERP5BankingCheckbookReception(TestERP5BankingMixin, ERP5TypeTestCase):
self.createFunctionGroupSiteCategory() self.createFunctionGroupSiteCategory()
self.createBanknotesAndCoins() self.createBanknotesAndCoins()
self.traveler_check_model = self.createTravelerCheckModel('traveler_check_model') self.traveler_check_model = self.createTravelerCheckModel('traveler_check_model')
self.checkbook_model_1 = self.createCheckbookModel('checkbook_model_1')
self.check_model_1 = self.createCheckModel('check_model_1') self.check_model_1 = self.createCheckModel('check_model_1')
self.checkbook_model_1 = self.createCheckbookModel('checkbook_model_1',
check_model=self.check_model_1)
self.reception = self.paris.caveau.auxiliaire.encaisse_des_billets_et_monnaies self.reception = self.paris.caveau.auxiliaire.encaisse_des_billets_et_monnaies
self.destination_site = self.paris self.destination_site = self.paris
self.checkUserFolderType() self.checkUserFolderType()
......
...@@ -183,8 +183,9 @@ class TestERP5BankingCheckbookVaultTransfer(TestERP5BankingCheckbookVaultTransfe ...@@ -183,8 +183,9 @@ class TestERP5BankingCheckbookVaultTransfer(TestERP5BankingCheckbookVaultTransfe
self.createManagerAndLogin() self.createManagerAndLogin()
self.createFunctionGroupSiteCategory() self.createFunctionGroupSiteCategory()
self.checkbook_model_1 = self.createCheckbookModel('checkbook_model_1')
self.check_model_1 = self.createCheckModel('check_model_1') self.check_model_1 = self.createCheckModel('check_model_1')
self.checkbook_model_1 = self.createCheckbookModel('checkbook_model_1',
check_model=self.check_model_1)
self.destination_site = self.paris self.destination_site = self.paris
self.createBanknotesAndCoins() self.createBanknotesAndCoins()
self.reception_destination_site = self.paris self.reception_destination_site = self.paris
...@@ -349,9 +350,9 @@ class TestERP5BankingCheckbookVaultTransfer(TestERP5BankingCheckbookVaultTransfe ...@@ -349,9 +350,9 @@ class TestERP5BankingCheckbookVaultTransfer(TestERP5BankingCheckbookVaultTransfe
""" """
state = self.checkbook_vault_transfer.getSimulationState() state = self.checkbook_vault_transfer.getSimulationState()
# check that state is draft # check that state is draft
self.assertEqual(state, 'confirmed') self.assertEqual(state, 'ordered')
self.workflow_tool.doActionFor(self.checkbook_vault_transfer, self.workflow_tool.doActionFor(self.checkbook_vault_transfer,
'confirm_to_deliver_action', 'order_to_deliver_action',
wf_id='checkbook_vault_transfer_workflow') wf_id='checkbook_vault_transfer_workflow')
# get state of cash sorting # get state of cash sorting
state = self.checkbook_vault_transfer.getSimulationState() state = self.checkbook_vault_transfer.getSimulationState()
...@@ -389,7 +390,7 @@ class TestERP5BankingCheckbookVaultTransfer(TestERP5BankingCheckbookVaultTransfe ...@@ -389,7 +390,7 @@ class TestERP5BankingCheckbookVaultTransfer(TestERP5BankingCheckbookVaultTransfe
Try if we get Insufficient balance Try if we get Insufficient balance
""" """
message = self.assertWorkflowTransitionFails(self.checkbook_vault_transfer, message = self.assertWorkflowTransitionFails(self.checkbook_vault_transfer,
'checkbook_vault_transfer_workflow','confirm_to_deliver_action') 'checkbook_vault_transfer_workflow','order_to_deliver_action')
self.failUnless(message.find('Sorry, the item with reference')>=0) self.failUnless(message.find('Sorry, the item with reference')>=0)
self.failUnless(message.find('is not available any more')>=0) self.failUnless(message.find('is not available any more')>=0)
...@@ -409,13 +410,13 @@ class TestERP5BankingCheckbookVaultTransfer(TestERP5BankingCheckbookVaultTransfe ...@@ -409,13 +410,13 @@ class TestERP5BankingCheckbookVaultTransfer(TestERP5BankingCheckbookVaultTransfe
+ 'CreateCheckAndCheckbookLineList Tic ' \ + 'CreateCheckAndCheckbookLineList Tic ' \
+ 'PlanCheckbookVaultTransfer Tic ' \ + 'PlanCheckbookVaultTransfer Tic ' \
+ 'OrderCheckbookVaultTransfer Tic ' \ + 'OrderCheckbookVaultTransfer Tic ' \
+ 'ConfirmCheckbookVaultTransfer Tic ' \
+ 'CheckConfirmedCheckbookInventory Tic ' \ + 'CheckConfirmedCheckbookInventory Tic ' \
+ 'ChangePreviousDeliveryDate Tic ' \ + 'ChangePreviousDeliveryDate Tic ' \
+ 'DeliverCheckbookVaultTransferFails Tic ' \ + 'DeliverCheckbookVaultTransferFails Tic ' \
+ 'PutBackPreviousDeliveryDate Tic ' \ + 'PutBackPreviousDeliveryDate Tic ' \
+ 'DeliverCheckbookVaultTransfer Tic ' \ + 'DeliverCheckbookVaultTransfer Tic ' \
+ 'CheckFinalCheckbookInventory' + 'CheckFinalCheckbookInventory'
#+ 'ConfirmCheckbookVaultTransfer Tic ' \
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
# play the sequence # play the sequence
sequence_list.play(self) sequence_list.play(self)
......
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