Commit 7fbf0468 authored by Sebastien Robin's avatar Sebastien Robin

make a proof that it is not possible to have a negative bank account value

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11138 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a61cdaaf
...@@ -166,7 +166,15 @@ class TestERP5BankingCheckPayment(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -166,7 +166,15 @@ class TestERP5BankingCheckPayment(TestERP5BankingMixin, ERP5TypeTestCase):
self.check_1 = self.createCheck(id='check_1', self.check_1 = self.createCheck(id='check_1',
reference='50', reference='50',
checkbook=self.checkbook_1) checkbook=self.checkbook_1)
self.check_2 = self.createCheck(id='check_2',
reference='51',
checkbook=self.checkbook_1)
self.check_3 = self.createCheck(id='check_3',
reference='52',
checkbook=self.checkbook_1)
self.check_4 = self.createCheck(id='check_4',
reference='53',
checkbook=self.checkbook_1)
def stepCheckObjects(self, sequence=None, sequence_list=None, **kwd): def stepCheckObjects(self, sequence=None, sequence_list=None, **kwd):
""" """
...@@ -233,6 +241,45 @@ class TestERP5BankingCheckPayment(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -233,6 +241,45 @@ class TestERP5BankingCheckPayment(TestERP5BankingMixin, ERP5TypeTestCase):
self.assertNotEqual(self.check_payment.getSourceReference(), None) self.assertNotEqual(self.check_payment.getSourceReference(), None)
self.assertNotEqual(self.check_payment.getSourceReference(), '') self.assertNotEqual(self.check_payment.getSourceReference(), '')
def stepValidateAnotherCheckPaymentWorks(self, sequence=None, sequence_list=None, **kwd):
""" Make sure we can validate another check payment """
self.createAnotherCheckPayment(sequence=sequence,will_fail=0,number="51")
def stepValidateAnotherCheckPaymentFails(self, sequence=None, sequence_list=None, **kwd):
""" Make sure that we can not validate another check payment """
self.createAnotherCheckPayment(sequence=sequence,will_fail=1,number="52")
def stepValidateAnotherCheckPaymentFailsAgain(self, sequence=None, sequence_list=None, **kwd):
""" Make sure that we can not validate another check payment """
self.createAnotherCheckPayment(sequence=sequence,will_fail=1,number="53")
def createAnotherCheckPayment(self, will_fail=0, sequence=None, number=None,**kwd):
new_payment = self.check_payment_module.newContent(portal_type = 'Check Payment',
destination_payment_value = self.bank_account_1,
# aggregate_value = self.check_1,
resource_value = self.currency_1,
aggregate_free_text = number,
# source_value = self.bi_counter,
start_date = DateTime().Date(),
source_total_asset_price = 90000.0)
new_payment._setSource(self.bi_counter.getRelativeUrl())
self.workflow_tool.doActionFor(new_payment, 'plan_action',
wf_id='check_payment_workflow')
self.assertEqual(new_payment.getSimulationState(), 'planned')
if will_fail:
self.assertRaises(ValidationFailed,self.workflow_tool.doActionFor,
new_payment, 'confirm_action',
wf_id='check_payment_workflow')
self.workflow_tool.doActionFor(new_payment, 'cancel_action',
wf_id='check_payment_workflow')
else:
self.workflow_tool.doActionFor(
new_payment, 'confirm_action',
wf_id='check_payment_workflow')
self.workflow_tool.doActionFor(new_payment, 'cancel_action',
wf_id='check_payment_workflow')
def stepCheckConsistency(self, sequence=None, sequence_list=None, **kwd): def stepCheckConsistency(self, sequence=None, sequence_list=None, **kwd):
""" """
Check the consistency of the check payment Check the consistency of the check payment
...@@ -332,8 +379,11 @@ class TestERP5BankingCheckPayment(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -332,8 +379,11 @@ class TestERP5BankingCheckPayment(TestERP5BankingMixin, ERP5TypeTestCase):
sequence_string = 'Tic CheckObjects Tic CheckInitialInventory ' \ sequence_string = 'Tic CheckObjects Tic CheckInitialInventory ' \
'CreateCheckPayment Tic ' \ 'CreateCheckPayment Tic ' \
'CheckConsistency Tic ' \ 'CheckConsistency Tic ' \
'SendToCounter Tic ' \ 'stepValidateAnotherCheckPaymentWorks Tic ' \
'SendToCounter ' \
'stepValidateAnotherCheckPaymentFails Tic ' \
'CheckConfirmedInventory ' \ 'CheckConfirmedInventory ' \
'stepValidateAnotherCheckPaymentFailsAgain Tic ' \
'InputCashDetails Tic ' \ 'InputCashDetails Tic ' \
'Pay Tic ' \ 'Pay Tic ' \
'CheckFinalInventory ' 'CheckFinalInventory '
......
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