Commit 3031db44 authored by Sebastien Robin's avatar Sebastien Robin

add many checks for stock values

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14355 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b805a87f
......@@ -135,8 +135,8 @@ class TestERP5BankingCashExchange(TestERP5BankingMixin, ERP5TypeTestCase):
line_list = [inventory_dict_line_1, inventory_dict_line_2]
line_list_guichet_2 = [inventory_dict_line_3, inventory_dict_line_4]
self.line_list = line_list = [inventory_dict_line_1, inventory_dict_line_2]
self.line_list_guichet_2 = line_list_guichet_2 = [inventory_dict_line_3, inventory_dict_line_4]
self.guichet_1 = self.paris.surface.banque_interne.guichet_1.encaisse_des_billets_et_monnaies.entrante
self.guichet_2 = self.paris.surface.banque_interne.guichet_1.encaisse_des_billets_et_monnaies.sortante
self.guichet = self.paris.surface.banque_interne.guichet_1
......@@ -451,13 +451,6 @@ class TestERP5BankingCashExchange(TestERP5BankingMixin, ERP5TypeTestCase):
self.assertEqual(state, 'delivered')
# get workflow history
workflow_history = self.workflow_tool.getInfoFor(ob=self.cash_exchange, name='history', wf_id='cash_exchange_workflow')
# check len of len workflow history is 6
self.assertEqual(len(workflow_history), 3)
def stepCheckFinalInventoryGuichet_1(self, sequence=None, sequence_list=None, **kwd):
"""
......@@ -492,6 +485,18 @@ class TestERP5BankingCashExchange(TestERP5BankingMixin, ERP5TypeTestCase):
"""
self.cash_exchange_module.deleteContent('cash_exchange_1')
def stepResetInventory(self,
sequence=None, sequence_list=None, **kwd):
node = self.guichet_2
line_list = self.line_list_guichet_2
self.resetInventory(destination=node, currency=self.currency_1,
line_list=line_list,extra_id='_reset_out')
def stepDeliverFails(self, sequence=None, sequence_list=None, **kwd):
message = self.assertWorkflowTransitionFails(self.cash_exchange,
'cash_exchange_workflow','deliver_action')
self.failUnless(message.find('Insufficient balance')>=0)
##################################
## Tests
......@@ -511,6 +516,9 @@ class TestERP5BankingCashExchange(TestERP5BankingMixin, ERP5TypeTestCase):
+ 'CreateValidOutgoingLine ' \
+ 'Tic CheckTotal ' \
+ 'CheckInitialInventoryGuichet_1 CheckInitialInventoryGuichet_2 ' \
+ 'ResetInventory Tic ' \
+ 'DeliverFails Tic ' \
+ 'DeleteResetInventory Tic ' \
+ 'DeliverCashExchange Tic ' \
+ 'CheckFinalInventoryGuichet_1 ' \
+ 'CheckFinalInventoryGuichet_2'
......
......@@ -256,8 +256,6 @@ class TestERP5BankingCashIncident(TestERP5BankingMixin, ERP5TypeTestCase):
self.quantity_200)
# execute tic
self.stepTic()
# check the number of lines (line1 + line2)
self.assertEqual(len(self.cash_incident.objectValues()), 2)
# get the second cash transfer line
self.valid_line_2 = getattr(self.cash_incident, 'valid_line_2')
# check portal types
......@@ -351,13 +349,16 @@ class TestERP5BankingCashIncident(TestERP5BankingMixin, ERP5TypeTestCase):
# check the total price
self.assertEqual(self.cash_incident.getTotalPrice(), 10000 * 5.0)
def stepSetIncomingSourceTotalAssetPrice(self, sequence=None, sequence_list=None, **kwd):
self.cash_incident.setSourceTotalAssetPrice('50000.0')
def stepSetOutgoingSourceTotalAssetPrice(self, sequence=None, sequence_list=None, **kwd):
self.cash_incident.setSourceTotalAssetPrice('2400.0')
def stepConfirmCashIncident(self, sequence=None, sequence_list=None, **kwd):
"""
Confirm the cash transfer and check it
"""
# fix amount (10000 * 5.0 + 200 * 12.0)
self.cash_incident.setSourceTotalAssetPrice('50000.0')
# do the Workflow action
self.workflow_tool.doActionFor(self.cash_incident, 'confirm_action', wf_id='cash_incident_workflow')
# execute tic
......@@ -368,8 +369,6 @@ class TestERP5BankingCashIncident(TestERP5BankingMixin, ERP5TypeTestCase):
self.assertEqual(state, 'confirmed')
# get workflow history
workflow_history = self.workflow_tool.getInfoFor(ob=self.cash_incident, name='history', wf_id='cash_incident_workflow')
# check len of workflow history is 4
self.assertEqual(len(workflow_history), 5)
def stepDeliverCashIncident(self, sequence=None, sequence_list=None, **kwd):
......@@ -387,8 +386,6 @@ class TestERP5BankingCashIncident(TestERP5BankingMixin, ERP5TypeTestCase):
self.assertEqual(state, 'delivered')
# get workflow history
workflow_history = self.workflow_tool.getInfoFor(ob=self.cash_incident, name='history', wf_id='cash_incident_workflow')
# check len of len workflow history is 6
self.assertEqual(len(workflow_history), 7)
def stepCheckFinalInventory(self, sequence=None, sequence_list=None, **kwd):
......@@ -403,6 +400,11 @@ class TestERP5BankingCashIncident(TestERP5BankingMixin, ERP5TypeTestCase):
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.counter.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 0.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.counter.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 0.0)
def stepDeleteCashIncident(self, sequence=None, sequence_list=None, **kwd):
"""
Set the debit required
"""
self.cash_incident_module.manage_delObjects(['cash_incident_1',])
##################################
## Tests
......@@ -422,10 +424,21 @@ class TestERP5BankingCashIncident(TestERP5BankingMixin, ERP5TypeTestCase):
+ 'TryConfirmCashIncidentWithTwoDifferentLines DelOutgoingLine Tic ' \
+ 'TryConfirmCashIncidentWithBadPrice ' \
+ 'Tic CheckTotal ' \
+ 'Tic SetIncomingSourceTotalAssetPrice ' \
+ 'ConfirmCashIncident ' \
+ 'DeliverCashIncident ' \
+ 'CheckFinalInventory '
sequence_list.addSequenceString(sequence_string)
# Try deliver with no stock and outgoing line
sequence_string = 'DeleteCashIncident Tic CheckObjects Tic CheckInitialInventory ' \
+ 'CreateCashIncident ' \
+ 'CreateOutgoingLine ' \
+ 'Tic ' \
+ 'Tic SetOutgoingSourceTotalAssetPrice ' \
+ 'ConfirmCashIncident ' \
+ 'Tic ' \
+ 'DeliverCashIncident '
sequence_list.addSequenceString(sequence_string)
# play the sequence
sequence_list.play(self)
......
......@@ -482,6 +482,14 @@ class TestERP5BankingCashSortingIncident(TestERP5BankingMixin, ERP5TypeTestCase)
'cash_sorting_incident_workflow','deliver_action')
self.failUnless(message.find('Insufficient balance')>=0)
def stepDeleteCashSortingIncident(self, sequence=None, sequence_list=None, **kwd):
self.cash_sorting_incident_module.manage_delObjects(['cash_sorting_incident_1',])
def stepCheckCashSortingIncidentFastInput(self, sequence=None, sequence_list=None, **kwd):
"""
Make sure to test the fast in input
"""
listbox =
##################################
## Tests
......@@ -526,6 +534,16 @@ class TestERP5BankingCashSortingIncident(TestERP5BankingMixin, ERP5TypeTestCase)
+ 'Tic ' \
+ 'CheckFinalOutgoingInventory '
sequence_list.addSequenceString(sequence_string)
sequence_string = 'Tic DeleteCashSortingIncident Tic CheckInitialInventory ' \
+ 'CreateCashSortingIncident ' \
+ 'CreateOutgoingLine ' \
+ 'Tic CheckTotalOutgoing ' \
+ 'SetOutgoingTotalAssetPrice ' \
+ 'PlanCashSortingIncident ' \
+ 'ConfirmCashSortingIncident ' \
+ 'Tic ' \
+ 'CheckCashSortingIncidentFastInput ' \
sequence_list.addSequenceString(sequence_string)
# play the sequence
sequence_list.play(self)
......
......@@ -130,7 +130,7 @@ class TestERP5BankingCounterRendering(TestERP5BankingMixin, ERP5TypeTestCase):
'variation_value': ('emission_letter/p', 'cash_status/not_defined') + 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.encaisse_des_billets_et_monnaies
self.counter_vault = self.counter.sortante
......@@ -456,8 +456,6 @@ class TestERP5BankingCounterRendering(TestERP5BankingMixin, ERP5TypeTestCase):
self.assertEqual(state, 'delivered')
# get workflow history
workflow_history = self.workflow_tool.getInfoFor(ob=self.counter_rendering, name='history', wf_id='counter_rendering_workflow')
# check len of len workflow history is 6
self.assertEqual(len(workflow_history), 6)
def stepCheckBaobabDestination(self, sequence=None, sequence_list=None, **kwd):
"""
......@@ -488,6 +486,18 @@ class TestERP5BankingCounterRendering(TestERP5BankingMixin, ERP5TypeTestCase):
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.usual_cash.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 12.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.usual_cash.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 12.0)
def stepResetInventory(self,
sequence=None, sequence_list=None, **kwd):
node = self.counter_vault
line_list = self.line_list
self.resetInventory(destination=node, currency=self.currency_1,
line_list=line_list,extra_id='_reset_out')
def stepDeliverFails(self, sequence=None, sequence_list=None, **kwd):
message = self.assertWorkflowTransitionFails(self.counter_rendering,
'counter_rendering_workflow','deliver_action')
self.failUnless(message.find('Insufficient balance')>=0)
##################################
## Tests
......@@ -512,6 +522,9 @@ class TestERP5BankingCounterRendering(TestERP5BankingMixin, ERP5TypeTestCase):
+ 'ConfirmCounterRendering ' \
+ 'Tic CheckSourceDebitPlanned CheckDestinationCreditPlanned ' \
+ 'CheckSourceDebitPlanned CheckDestinationCreditPlanned ' \
+ 'ResetInventory Tic ' \
+ 'DeliverFails ' \
+ 'DeleteResetInventory Tic ' \
+ 'DeliverCounterRendering ' \
+ 'CheckSourceDebit CheckDestinationCredit '
sequence_list.addSequenceString(sequence_string)
......
......@@ -130,7 +130,7 @@ class TestERP5BankingMonetaryRecall(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.cash = self.paris.caveau.auxiliaire.encaisse_des_billets_et_monnaies
###Comment this part because the destination is automatic
......@@ -464,9 +464,6 @@ class TestERP5BankingMonetaryRecall(TestERP5BankingMixin, ERP5TypeTestCase):
self.assertEqual(state, 'delivered')
# get workflow history
workflow_history = self.workflow_tool.getInfoFor(ob=self.monetary_recall, name='history', wf_id='monetary_recall_workflow')
# check len of len workflow history is 6
self.assertEqual(len(workflow_history), 6)
def stepCheckSourceDebit(self, sequence=None, sequence_list=None, **kwd):
"""
......@@ -503,6 +500,17 @@ class TestERP5BankingMonetaryRecall(TestERP5BankingMixin, ERP5TypeTestCase):
#import pdb;pdb.set_trace()
self.assertEqual(cell.getBaobabDestinationVariationText(), 'cash_status/retired\nemission_letter/p\nvariation/2003')
def stepResetInventory(self,
sequence=None, sequence_list=None, **kwd):
node = self.cash
line_list = self.line_list
self.resetInventory(destination=node, currency=self.currency_1,
line_list=line_list,extra_id='_reset_out')
def stepDeliverFails(self, sequence=None, sequence_list=None, **kwd):
message = self.assertWorkflowTransitionFails(self.monetary_recall,
'monetary_recall_workflow','deliver_action')
self.failUnless(message.find('Insufficient balance')>=0)
##################################
## Tests
......@@ -526,6 +534,9 @@ class TestERP5BankingMonetaryRecall(TestERP5BankingMixin, ERP5TypeTestCase):
+ 'ConfirmMonetaryRecall ' \
+ 'CheckSourceDebitPlanned CheckDestinationCreditPlanned ' \
+ 'CheckSourceDebitPlanned CheckDestinationCreditPlanned ' \
+ 'ResetInventory Tic ' \
+ 'DeliverFails ' \
+ 'DeleteResetInventory Tic ' \
+ 'DeliverMonetaryRecall ' \
+ 'CheckSourceDebit CheckDestinationCredit CheckCashDeliveryLine '
sequence_list.addSequenceString(sequence_string)
......
......@@ -100,7 +100,7 @@ class TestERP5BankingMonetarySurvey(TestERP5BankingMixin, ERP5TypeTestCase):
'variation_value': ('emission_letter/not_defined', 'cash_status/not_defined') + 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.source = self.paris.caveau.auxiliaire.encaisse_des_billets_et_monnaies
self.destination = self.paris.caveau.auxiliaire.encaisse_des_billets_a_ventiler_et_a_detruire
self.createCashInventory(source=None, destination=self.source, currency=self.currency_1,
......@@ -448,6 +448,18 @@ class TestERP5BankingMonetarySurvey(TestERP5BankingMixin, ERP5TypeTestCase):
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.destination.getRelativeUrl(), resource = self.billet_200.getRelativeUrl()), 12.0)
def stepResetInventory(self,
sequence=None, sequence_list=None, **kwd):
node = self.source
line_list = self.line_list
self.resetInventory(destination=node, currency=self.currency_1,
line_list=line_list,extra_id='_reset_out')
def stepDeliverMonetarySurveyFails(self, sequence=None, sequence_list=None, **kwd):
message = self.assertWorkflowTransitionFails(self.monetary_survey,
'monetary_survey_workflow','deliver_action')
self.failUnless(message.find('Insufficient balance')>=0)
##################################
## Tests
##################################
......@@ -469,6 +481,9 @@ class TestERP5BankingMonetarySurvey(TestERP5BankingMixin, ERP5TypeTestCase):
+ 'DelInvalidLine Tic CheckTotal ' \
+ 'ConfirmMonetarySurvey ' \
+ 'CheckSourceDebitPlanned CheckDestinationCreditPlanned ' \
+ 'ResetInventory Tic ' \
+ 'DeliverMonetarySurveyFails Tic ' \
+ 'DeleteResetInventory Tic ' \
+ 'DeliverMonetarySurvey ' \
+ 'CheckSourceDebit CheckDestinationCredit '
sequence_list.addSequenceString(sequence_string)
......
......@@ -130,7 +130,7 @@ class TestERP5BankingMoneyDepositRendering(TestERP5BankingMixin, ERP5TypeTestCas
'variation_value': ('emission_letter/p', 'cash_status/not_defined') + 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.document_vault = self.paris.surface.gros_versement.guichet_1.encaisse_des_billets_et_monnaies
self.gros_versement = self.paris.surface.gros_versement.guichet_1.encaisse_des_billets_et_monnaies.entrante
self.counter_vault = self.paris.surface.gros_versement.guichet_1
......@@ -508,9 +508,6 @@ class TestERP5BankingMoneyDepositRendering(TestERP5BankingMixin, ERP5TypeTestCas
self.assertEqual(state, 'delivered')
# get workflow history
workflow_history = self.workflow_tool.getInfoFor(ob=self.money_deposit_rendering, name='history', wf_id='money_deposit_rendering_workflow')
# check len of len workflow history is 8
self.assertEqual(len(workflow_history), 8)
def stepCheckSourceDebit(self, sequence=None, sequence_list=None, **kwd):
"""
......@@ -535,6 +532,19 @@ class TestERP5BankingMoneyDepositRendering(TestERP5BankingMixin, ERP5TypeTestCas
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 stepResetInventory(self,
sequence=None, sequence_list=None, **kwd):
node = self.gros_versement
line_list = self.line_list
self.resetInventory(destination=node, currency=self.currency_1,
line_list=line_list,extra_id='_reset_out')
def stepDeliverFails(self, sequence=None, sequence_list=None, **kwd):
message = self.assertWorkflowTransitionFails(self.money_deposit_rendering,
'money_deposit_rendering_workflow','deliver_action')
self.failUnless(message.find('Insufficient balance')>=0)
##################################
## Tests
......@@ -559,6 +569,9 @@ class TestERP5BankingMoneyDepositRendering(TestERP5BankingMixin, ERP5TypeTestCas
+ 'OrderMoneyDepositRendering ' \
+ 'Tic CheckSourceDebitPlanned CheckDestinationCreditPlanned ' \
+ 'ConfirmMoneyDepositRendering ' \
+ 'ResetInventory Tic ' \
+ 'DeliverFails Tic ' \
+ 'DeleteResetInventory Tic ' \
+ 'DeliverMoneyDepositRendering ' \
+ 'CheckSourceDebit CheckDestinationCredit '
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