Commit efc9413d authored by Sebastien Robin's avatar Sebastien Robin

updated unit test in order to test new functionnality

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15479 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1a8c6b39
...@@ -188,26 +188,6 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -188,26 +188,6 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase):
# check we have 12 coin of 200 in vault_source # check we have 12 coin of 200 in vault_source
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.vault_source.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 12.0) self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.vault_source.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 12.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.vault_source.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 12.0) self.assertEqual(self.simulation_tool.getFutureInventory(node=self.vault_source.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 12.0)
def stepCheckSource(self, sequence=None, sequence_list=None, **kwd):
"""
Check inventory in source vault (vault_source) before a confirm
"""
# check we have 5 banknotes of 10000
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.vault_source.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 5.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.vault_source.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 5.0)
# check we have 12 coin of 200
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.vault_source.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 12.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.vault_source.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 12.0)
def stepCheckDestination(self, sequence=None, sequence_list=None, **kwd):
"""
Check inventory in destination vault (vault_destination) before confirm
"""
# check we don't have banknotes of 10000 # check we don't have banknotes of 10000
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.vault_destination.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 0.0) self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.vault_destination.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 0.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.vault_destination.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 0.0) self.assertEqual(self.simulation_tool.getFutureInventory(node=self.vault_destination.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 0.0)
...@@ -215,8 +195,8 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -215,8 +195,8 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase):
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.vault_destination.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 0.0) self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.vault_destination.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 0.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.vault_destination.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 0.0) self.assertEqual(self.simulation_tool.getFutureInventory(node=self.vault_destination.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 0.0)
def stepCreateCashMovement(self, sequence=None, sequence_list=None,
def stepCreateCashMovement(self, sequence=None, sequence_list=None, **kwd): none_destination=0, **kwd):
""" """
Create a vault transfer document and check it Create a vault transfer document and check it
""" """
...@@ -280,7 +260,6 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -280,7 +260,6 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase):
# check the source vault is vault_source # check the source vault is vault_source
self.assertEqual(cell.getSourceValue(), self.vault_source) self.assertEqual(cell.getSourceValue(), self.vault_source)
# check the destination vault is vault_destination # check the destination vault is vault_destination
self.assertEqual(cell.getDestinationValue(), self.vault_destination)
if cell.getId() == 'movement_0_0_0': if cell.getId() == 'movement_0_0_0':
# check the quantity of banknote for year 1992 is 2 # check the quantity of banknote for year 1992 is 2
self.assertEqual(cell.getQuantity(), 2.0) self.assertEqual(cell.getQuantity(), 2.0)
...@@ -474,10 +453,6 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -474,10 +453,6 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase):
state = self.cash_movement.getSimulationState() state = self.cash_movement.getSimulationState()
# check state is confirmed # check state is confirmed
self.assertEqual(state, 'confirmed') self.assertEqual(state, 'confirmed')
# get workflow history
workflow_history = self.workflow_tool.getInfoFor(ob=self.cash_movement, name='history', wf_id='cash_movement_workflow')
# check len of workflow history is 4
self.assertEqual(len(workflow_history), 4)
def stepStartCashMovement(self, sequence=None, sequence_list=None, **kwd): def stepStartCashMovement(self, sequence=None, sequence_list=None, **kwd):
""" """
...@@ -493,8 +468,6 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -493,8 +468,6 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase):
state = self.cash_movement.getSimulationState() state = self.cash_movement.getSimulationState()
# check state is started # check state is started
self.assertEqual(state, 'started') self.assertEqual(state, 'started')
# get workflow history
workflow_history = self.workflow_tool.getInfoFor(ob=self.cash_movement, name='history', wf_id='cash_movement_workflow')
def stepCheckSourceDebitStarted(self, sequence=None, sequence_list=None, **kwd): def stepCheckSourceDebitStarted(self, sequence=None, sequence_list=None, **kwd):
""" """
...@@ -540,6 +513,10 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -540,6 +513,10 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase):
# check len of len workflow history is 6 # check len of len workflow history is 6
self.assertEqual(len(workflow_history), 6) self.assertEqual(len(workflow_history), 6)
def stepSetCashMovementCurrencyHandover(self, sequence=None, sequence_list=None, **kwd):
self.cash_movement.setCurrencyHandover(True)
self.cash_movement.setDestination(None)
def stepDeliverCashMovement(self, sequence=None, sequence_list=None, **kwd): def stepDeliverCashMovement(self, sequence=None, sequence_list=None, **kwd):
""" """
Deliver the cash_movement with a good user Deliver the cash_movement with a good user
...@@ -553,8 +530,6 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -553,8 +530,6 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase):
state = self.cash_movement.getSimulationState() state = self.cash_movement.getSimulationState()
# check that state is delivered # check that state is delivered
self.assertEqual(state, 'delivered') self.assertEqual(state, 'delivered')
# get workflow history
workflow_history = self.workflow_tool.getInfoFor(ob=self.cash_movement, name='history', wf_id='cash_movement_workflow')
def stepCheckSourceDebit(self, sequence=None, sequence_list=None, **kwd): def stepCheckSourceDebit(self, sequence=None, sequence_list=None, **kwd):
...@@ -581,6 +556,17 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -581,6 +556,17 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase):
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.vault_destination.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 12.0) self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.vault_destination.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 12.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.vault_destination.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 12.0) self.assertEqual(self.simulation_tool.getFutureInventory(node=self.vault_destination.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 12.0)
def stepCheckDestinationHasNotChanged(self, sequence=None, sequence_list=None, **kwd):
"""
Check inventory at destination (vault vault_destination) after deliver of the cash_movement
"""
# check we have 5 banknotes of 10000
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.vault_destination.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 0.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.vault_destination.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 0.0)
# check we have 12 coins of 200
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.vault_destination.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 0.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.vault_destination.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 0.0)
def stepResetSourceInventory(self, def stepResetSourceInventory(self,
sequence=None, sequence_list=None, **kwd): sequence=None, sequence_list=None, **kwd):
""" """
...@@ -591,6 +577,9 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -591,6 +577,9 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase):
self.resetInventory(destination=node, currency=self.currency_1, self.resetInventory(destination=node, currency=self.currency_1,
line_list=line_list,extra_id='_reset_out') line_list=line_list,extra_id='_reset_out')
def stepDelCashMovement(self, sequence=None, sequence_list=None, **kwd):
self.cash_movement_module.deleteContent('cash_movement_1')
def stepStartCashMovementFails(self, sequence=None, sequence_list=None, **kwd): def stepStartCashMovementFails(self, sequence=None, sequence_list=None, **kwd):
""" """
Try if we get Insufficient balance Try if we get Insufficient balance
...@@ -607,11 +596,11 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -607,11 +596,11 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase):
if not run: return if not run: return
sequence_list = SequenceList() sequence_list = SequenceList()
# define the sequence # define the sequence
sequence_string = 'Tic CheckObjects Tic CheckInitialInventory CheckSource CheckDestination ' \ sequence_string = 'Tic CheckObjects Tic CheckInitialInventory ' \
+ 'CreateCashMovement ' \ + 'CreateCashMovement ' \
+ 'CreateValidLine1 CheckSubTotal ' \ + 'CreateValidLine1 CheckSubTotal ' \
+ 'CreateValidLine2 CheckTotal ' \ + 'CreateValidLine2 CheckTotal ' \
+ 'CheckSource CheckDestination ' \ + 'CheckInitialInventory ' \
+ 'CreateInvalidLine ' \ + 'CreateInvalidLine ' \
+ 'TryConfirmCashMovementWithBadInventory ' \ + 'TryConfirmCashMovementWithBadInventory ' \
+ 'DelInvalidLine Tic CheckTotal ' \ + 'DelInvalidLine Tic CheckTotal ' \
...@@ -626,6 +615,23 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -626,6 +615,23 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase):
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
# Another sequence in order to test that the currency handover
# is working
sequence_string = 'Tic DelCashMovement Tic CheckInitialInventory ' \
+ 'CreateCashMovement ' \
+ 'SetCashMovementCurrencyHandover ' \
+ 'CreateValidLine1 CheckSubTotal ' \
+ 'CreateValidLine2 CheckTotal ' \
+ 'CheckInitialInventory ' \
+ 'Tic CheckTotal ' \
+ 'ConfirmCashMovement ' \
+ 'StartCashMovement ' \
+ 'CheckSourceDebitStarted CheckDestinationHasNotChanged ' \
+ 'StopCashMovement ' \
+ 'DeliverCashMovement ' \
+ 'CheckSourceDebit CheckDestinationHasNotChanged '
sequence_list.addSequenceString(sequence_string)
# play the sequence # play the sequence
sequence_list.play(self) sequence_list.play(self)
......
...@@ -142,15 +142,24 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -142,15 +142,24 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
'variation_id': ('emission_letter', 'cash_status', 'variation'), 'variation_id': ('emission_letter', 'cash_status', 'variation'),
'variation_value': ('emission_letter/s', 'cash_status/cancelled') + self.variation_list, 'variation_value': ('emission_letter/s', 'cash_status/cancelled') + self.variation_list,
'quantity': self.quantity_5000} 'quantity': self.quantity_5000}
inventory_dict_line_for_dematerialization = {'id' : 'inventory_line_3',
'resource': self.piece_200,
'variation_id': ('emission_letter', 'cash_status', 'variation'),
'variation_value': ('emission_letter/p', 'cash_status/retired') + self.variation_list,
'quantity': self.quantity_200}
self.line_list = line_list = [inventory_dict_line_1, inventory_dict_line_2] self.line_list = line_list = [inventory_dict_line_1, inventory_dict_line_2]
self.line_list_for_externe = line_list_for_externe = [inventory_dict_line_for_externe_1, inventory_dict_line_for_externe_2] self.line_list_for_externe = line_list_for_externe = [inventory_dict_line_for_externe_1, inventory_dict_line_for_externe_2]
self.line_list_for_dematerialization = [inventory_dict_line_for_dematerialization]
self.source = self.paris.caveau.serre.encaisse_des_billets_retires_de_la_circulation self.source = self.paris.caveau.serre.encaisse_des_billets_retires_de_la_circulation
self.source_for_externe = self.paris.caveau.auxiliaire.encaisse_des_externes self.source_for_externe = self.paris.caveau.auxiliaire.encaisse_des_externes
###self.destinat = self.paris.caveau.serre.encaisse_des_billets_detruits ###self.destinat = self.paris.caveau.serre.encaisse_des_billets_detruits
self.destination = self.paris.caveau.serre.encaisse_des_billets_neufs_non_emis_en_transit_allant_a.madrid
self.createCashInventory(source=None, destination=self.source, currency=self.currency_1, self.createCashInventory(source=None, destination=self.source, currency=self.currency_1,
line_list=line_list) line_list=line_list)
self.createCashInventory(source=None, destination=self.source, currency=self.currency_1,
line_list=self.line_list_for_dematerialization)
self.createCashInventory(source=None, destination=self.source_for_externe, currency=self.currency_1, self.createCashInventory(source=None, destination=self.source_for_externe, currency=self.currency_1,
line_list=line_list_for_externe) line_list=line_list_for_externe)
...@@ -176,9 +185,6 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -176,9 +185,6 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
self.openCounterDate(site=self.paris) self.openCounterDate(site=self.paris)
self.openCounterDate(site=self.madrid,id='counter_date_2') self.openCounterDate(site=self.madrid,id='counter_date_2')
def stepCheckObjects(self, sequence=None, sequence_list=None, **kwd): def stepCheckObjects(self, sequence=None, sequence_list=None, **kwd):
""" """
Check that all the objects we created in afterSetUp or Check that all the objects we created in afterSetUp or
...@@ -204,47 +210,50 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -204,47 +210,50 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.source.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 24.0) self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.source.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 24.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.source.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 24.0) self.assertEqual(self.simulation_tool.getFutureInventory(node=self.source.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 24.0)
def stepCheckInitialInventoryForDematerialization(self, sequence=None, sequence_list=None, **kwd):
def stepCheckInitialInventoryForExterne(self, sequence=None, sequence_list=None, **kwd):
""" """
Check the initial inventory before any operations Check the initial inventory before any operations
""" """
self.simulation_tool = self.getSimulationTool() self.simulation_tool = self.getSimulationTool()
# check we have 5 banknotes of 10000 in source # check we have 12 coins in source
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 5.0) self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.source.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 12.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 5.0) self.assertEqual(self.simulation_tool.getFutureInventory(node=self.source.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 12.0)
# check we have 24 banknotes of 5000 in source # check we have 0 coins in destination
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 24.0) self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.destination.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 0.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 24.0) self.assertEqual(self.simulation_tool.getFutureInventory(node=self.destination.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 0.0)
def stepCheckFinalInventoryForDematerialization(self, sequence=None, sequence_list=None, **kwd):
def stepCheckSource(self, sequence=None, sequence_list=None, **kwd):
""" """
Check inventory in source vault (source) before a confirm Check the initial inventory before any operations
""" """
# check we have 5 banknotes of 10000 self.simulation_tool = self.getSimulationTool()
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.source.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 5.0) # check we have 0 coins in source
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.source.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 5.0) self.assertEqual(self.simulation_tool.getCurrentInventory(
# check we have 24 banknotes of 5000 node=self.source.getRelativeUrl(),
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.source.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 24.0) resource = self.piece_200.getRelativeUrl()), 0.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.source.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 24.0) self.assertEqual(self.simulation_tool.getFutureInventory(
node=self.source.getRelativeUrl(),
resource = self.piece_200.getRelativeUrl()), 0.0)
# check we have 12 coins in destination
self.assertEqual(self.simulation_tool.getCurrentInventory(
node=self.destination.getRelativeUrl(),
resource = self.piece_200.getRelativeUrl()), 12.0)
self.assertEqual(self.simulation_tool.getFutureInventory(
node=self.destination.getRelativeUrl(),
resource = self.piece_200.getRelativeUrl()), 12.0)
def stepCheckSourceForExterne(self, sequence=None, sequence_list=None, **kwd): def stepCheckInitialInventoryForExterne(self, sequence=None, sequence_list=None, **kwd):
""" """
Check inventory in source vault (source) before a confirm Check the initial inventory before any operations
""" """
# check we have 5 banknotes of 10000 self.simulation_tool = self.getSimulationTool()
# check we have 5 banknotes of 10000 in source
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 5.0) self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 5.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 5.0) self.assertEqual(self.simulation_tool.getFutureInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 5.0)
# check we have 24 banknotes of 5000 # check we have 24 banknotes of 5000 in source
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 24.0) self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 24.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 24.0) self.assertEqual(self.simulation_tool.getFutureInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 24.0)
def stepCreateMonetaryDestruction(self, sequence=None, sequence_list=None, **kwd): def stepCreateMonetaryDestruction(self, sequence=None, sequence_list=None, **kwd):
""" """
Create a monetary destruction document and check it Create a monetary destruction document and check it
...@@ -277,18 +286,24 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -277,18 +286,24 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
# check that its destination is destinat # check that its destination is destinat
##self.assertEqual(self.monetary_destruction.getDestination(), 'site/testsite/paris/caveau/serre/encaisse_des_billets_detruits') ##self.assertEqual(self.monetary_destruction.getDestination(), 'site/testsite/paris/caveau/serre/encaisse_des_billets_detruits')
def stepCreateMonetaryDestructionForDematerialization(self,
sequence=None, sequence_list=None, **kwd):
self.stepCreateMonetaryDestruction(sequence=sequence, **kwd)
self.monetary_destruction.setDematerialization(True)
self.monetary_destruction.setSourceSectionValue(self.madrid)
def stepCreateMonetaryDestructionForExterne(self, sequence=None, sequence_list=None, **kwd): def stepCreateMonetaryDestructionForExterne(self, sequence=None, sequence_list=None, **kwd):
""" """
Create a monetary destruction document and check it Create a monetary destruction document and check it
""" """
# Monetary Destruction has source(serre) for source, destinat (serre) for destination, and a price coresponding to the sum of banknote of 10000 and of 5000 ( (2*3) * 10000 + (5*7) * 5000 ) # Monetary Destruction has source(serre) for source, destinat (serre) for destination, and a price coresponding to the sum of banknote of 10000 and of 5000 ( (2*3) * 10000 + (5*7) * 5000 )
self.monetary_destruction = self.monetary_destruction_module.newContent(id='monetary_destruction_1', self.monetary_destruction = self.monetary_destruction_module.newContent(
portal_type='Monetary Destruction', id='monetary_destruction_1',
source_value=self.source_for_externe, portal_type='Monetary Destruction',
destination_value=None, source_value=self.source_for_externe,
source_total_asset_price=110000.0, destination_value=None,
source_section_value=self.madrid) source_total_asset_price=110000.0,
source_section_value=self.madrid)
# execute tic # execute tic
self.stepTic() self.stepTic()
# set source reference # set source reference
...@@ -305,7 +320,6 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -305,7 +320,6 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
# check that its source is source # check that its source is source
self.assertEqual(self.monetary_destruction.getSource(), 'site/testsite/paris/caveau/auxiliaire/encaisse_des_externes') self.assertEqual(self.monetary_destruction.getSource(), 'site/testsite/paris/caveau/auxiliaire/encaisse_des_externes')
# check that its destination is destinat # check that its destination is destinat
##self.assertEqual(self.monetary_destruction.getDestination(), 'site/testsite/paris/caveau/serre/encaisse_des_billets_detruits')
def stepCreateValidLine1(self, sequence=None, sequence_list=None, **kwd): def stepCreateValidLine1(self, sequence=None, sequence_list=None, **kwd):
...@@ -313,7 +327,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -313,7 +327,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
Create the monetary destruction line 1 with banknotes of 10000 and check it has been well created Create the monetary destruction line 1 with banknotes of 10000 and check it has been well created
""" """
# create the monetary destruction line # create the monetary destruction line
self.addCashLineToDelivery(self.monetary_destruction, 'valid_line_1', 'Cash Delivery Line', self.billet_10000, self.addCashLineToDelivery(self.monetary_destruction, 'valid_line_1', 'Monetary Destruction Line', self.billet_10000,
('emission_letter', 'cash_status', 'variation'), ('emission_letter/p', 'cash_status/cancelled') + self.variation_list, ('emission_letter', 'cash_status', 'variation'), ('emission_letter/p', 'cash_status/cancelled') + self.variation_list,
self.quantity_10000) self.quantity_10000)
# execute tic # execute tic
...@@ -323,7 +337,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -323,7 +337,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
# get the monetary destruction line # get the monetary destruction line
self.valid_line_1 = getattr(self.monetary_destruction, 'valid_line_1') self.valid_line_1 = getattr(self.monetary_destruction, '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(), 'Monetary Destruction 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
...@@ -337,7 +351,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -337,7 +351,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
# get the delivery cell # get the delivery cell
cell = self.valid_line_1.getCell('emission_letter/p', variation, 'cash_status/cancelled') cell = self.valid_line_1.getCell('emission_letter/p', variation, 'cash_status/cancelled')
# chek portal types # chek portal types
self.assertEqual(cell.getPortalType(), 'Cash Delivery Cell') self.assertEqual(cell.getPortalType(), 'Monetary Destruction 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 source # check the source vault is source
...@@ -359,7 +373,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -359,7 +373,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
Create the monetary destruction line 1 with banknotes of 10000 and check it has been well created Create the monetary destruction line 1 with banknotes of 10000 and check it has been well created
""" """
# create the monetary destruction line # create the monetary destruction line
self.addCashLineToDelivery(self.monetary_destruction, 'valid_line_1', 'Cash Delivery Line', self.billet_10000, self.addCashLineToDelivery(self.monetary_destruction, 'valid_line_1', 'Monetary Destruction Line', self.billet_10000,
('emission_letter', 'cash_status', 'variation'), ('emission_letter/s', 'cash_status/cancelled') + self.variation_list, ('emission_letter', 'cash_status', 'variation'), ('emission_letter/s', 'cash_status/cancelled') + self.variation_list,
self.quantity_10000) self.quantity_10000)
# execute tic # execute tic
...@@ -369,7 +383,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -369,7 +383,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
# get the monetary destruction line # get the monetary destruction line
self.valid_line_1 = getattr(self.monetary_destruction, 'valid_line_1') self.valid_line_1 = getattr(self.monetary_destruction, '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(), 'Monetary Destruction 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
...@@ -383,7 +397,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -383,7 +397,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
# get the delivery cell # get the delivery cell
cell = self.valid_line_1.getCell('emission_letter/s', variation, 'cash_status/cancelled') cell = self.valid_line_1.getCell('emission_letter/s', variation, 'cash_status/cancelled')
# chek portal types # chek portal types
self.assertEqual(cell.getPortalType(), 'Cash Delivery Cell') self.assertEqual(cell.getPortalType(), 'Monetary Destruction 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 source # check the source vault is source
...@@ -399,6 +413,44 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -399,6 +413,44 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
else: else:
self.fail('Wrong cell created : %s' % cell.getId()) self.fail('Wrong cell created : %s' % cell.getId())
def stepCreateValidLineForDematerialization(self, sequence=None, sequence_list=None, **kwd):
"""
Create the vault transfer line 2 wiht coins of 200 and check it has been well created
"""
# create the line
self.addCashLineToDelivery(self.monetary_destruction, 'valid_line_1', 'Monetary Destruction Line', self.piece_200,
('emission_letter', 'cash_status', 'variation'), ('emission_letter/p', 'cash_status/retired') + self.variation_list,
self.quantity_200)
# execute tic
self.stepTic()
# check the number of lines (line1 + line2)
self.assertEqual(len(self.monetary_destruction.objectValues()), 1)
# get the second vault transfer line
self.valid_line_1 = getattr(self.monetary_destruction, 'valid_line_1')
# check portal types
self.assertEqual(self.valid_line_1.getPortalType(), 'Monetary Destruction Line')
# check the resource is coin of 200
self.assertEqual(self.valid_line_1.getResourceValue(), self.piece_200)
# check the value of coin
self.assertEqual(self.valid_line_1.getPrice(), 200.0)
# check the unit of coin
self.assertEqual(self.valid_line_1.getQuantityUnit(), 'unit')
# check we have two delivery cells: (one for year 1992 and one for 2003)
self.assertEqual(len(self.valid_line_1.objectValues()), 2)
for variation in self.variation_list:
# get the delivery cell
cell = self.valid_line_1.getCell('emission_letter/p', variation, 'cash_status/retired')
# check the portal type
self.assertEqual(cell.getPortalType(), 'Monetary Destruction Cell')
self.failUnless(cell.getBaobabDestinationVariationText().find('new_not_emitted')>=0)
if cell.getId() == 'movement_0_0_0':
# check the quantity for coin for year 1992 is 5
self.assertEqual(cell.getQuantity(), 5.0)
elif cell.getId() == 'movement_0_1_0':
# check the quantity for coin for year 2003 is 7
self.assertEqual(cell.getQuantity(), 7.0)
else:
self.fail('Wrong cell created : %s' % cell.getId())
def stepCheckSubTotal(self, sequence=None, sequence_list=None, **kwd): def stepCheckSubTotal(self, sequence=None, sequence_list=None, **kwd):
...@@ -418,7 +470,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -418,7 +470,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
Create the monetary destruction line 2 wiht banknotes of 5000 and check it has been well created Create the monetary destruction line 2 wiht banknotes of 5000 and check it has been well created
""" """
# create the line # create the line
self.addCashLineToDelivery(self.monetary_destruction, 'valid_line_2', 'Cash Delivery Line', self.billet_5000, self.addCashLineToDelivery(self.monetary_destruction, 'valid_line_2', 'Monetary Destruction Line', self.billet_5000,
('emission_letter', 'cash_status', 'variation'), ('emission_letter/p', 'cash_status/cancelled') + self.variation_list, ('emission_letter', 'cash_status', 'variation'), ('emission_letter/p', 'cash_status/cancelled') + self.variation_list,
self.quantity_5000) self.quantity_5000)
# execute tic # execute tic
...@@ -428,7 +480,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -428,7 +480,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
# get the second monetary destruction line # get the second monetary destruction line
self.valid_line_2 = getattr(self.monetary_destruction, 'valid_line_2') self.valid_line_2 = getattr(self.monetary_destruction, '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(), 'Monetary Destruction Line')
# check the resource is banknotes of 5000 # check the resource is banknotes of 5000
self.assertEqual(self.valid_line_2.getResourceValue(), self.billet_5000) self.assertEqual(self.valid_line_2.getResourceValue(), self.billet_5000)
# check the value of banknote # check the value of banknote
...@@ -441,7 +493,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -441,7 +493,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
# get the delivery cell # get the delivery cell
cell = self.valid_line_2.getCell('emission_letter/p', variation, 'cash_status/cancelled') cell = self.valid_line_2.getCell('emission_letter/p', variation, 'cash_status/cancelled')
# check the portal type # check the portal type
self.assertEqual(cell.getPortalType(), 'Cash Delivery Cell') self.assertEqual(cell.getPortalType(), 'Monetary Destruction Cell')
if cell.getId() == 'movement_0_0_0': if cell.getId() == 'movement_0_0_0':
# check the quantity for banknote for year 1992 is 5 # check the quantity for banknote for year 1992 is 5
self.assertEqual(cell.getQuantity(), 11.0) self.assertEqual(cell.getQuantity(), 11.0)
...@@ -457,7 +509,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -457,7 +509,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
Create the monetary destruction line 2 wiht banknotes of 5000 and check it has been well created Create the monetary destruction line 2 wiht banknotes of 5000 and check it has been well created
""" """
# create the line # create the line
self.addCashLineToDelivery(self.monetary_destruction, 'valid_line_2', 'Cash Delivery Line', self.billet_5000, self.addCashLineToDelivery(self.monetary_destruction, 'valid_line_2', 'Monetary Destruction Line', self.billet_5000,
('emission_letter', 'cash_status', 'variation'), ('emission_letter/s', 'cash_status/cancelled') + self.variation_list, ('emission_letter', 'cash_status', 'variation'), ('emission_letter/s', 'cash_status/cancelled') + self.variation_list,
self.quantity_5000) self.quantity_5000)
# execute tic # execute tic
...@@ -467,7 +519,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -467,7 +519,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
# get the second monetary destruction line # get the second monetary destruction line
self.valid_line_2 = getattr(self.monetary_destruction, 'valid_line_2') self.valid_line_2 = getattr(self.monetary_destruction, '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(), 'Monetary Destruction Line')
# check the resource is banknotes of 5000 # check the resource is banknotes of 5000
self.assertEqual(self.valid_line_2.getResourceValue(), self.billet_5000) self.assertEqual(self.valid_line_2.getResourceValue(), self.billet_5000)
# check the value of banknote # check the value of banknote
...@@ -480,7 +532,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -480,7 +532,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
# get the delivery cell # get the delivery cell
cell = self.valid_line_2.getCell('emission_letter/s', variation, 'cash_status/cancelled') cell = self.valid_line_2.getCell('emission_letter/s', variation, 'cash_status/cancelled')
# check the portal type # check the portal type
self.assertEqual(cell.getPortalType(), 'Cash Delivery Cell') self.assertEqual(cell.getPortalType(), 'Monetary Destruction Cell')
if cell.getId() == 'movement_0_0_0': if cell.getId() == 'movement_0_0_0':
# check the quantity for banknote for year 1992 is 5 # check the quantity for banknote for year 1992 is 5
self.assertEqual(cell.getQuantity(), 11.0) self.assertEqual(cell.getQuantity(), 11.0)
...@@ -499,7 +551,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -499,7 +551,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
""" """
# create a line in which quanity of coin of 200 is higher that quantity available at source # create a line in which quanity of coin of 200 is higher that quantity available at source
# here create a line with 12 (5+7) coin of 200 although the vault source has no coin of 200 # here create a line with 12 (5+7) coin of 200 although the vault source has no coin of 200
self.addCashLineToDelivery(self.monetary_destruction, 'invalid_line', 'Cash Delivery Line', self.piece_200, self.addCashLineToDelivery(self.monetary_destruction, 'invalid_line', 'Monetary Destruction Line', self.piece_200,
('emission_letter', 'cash_status', 'variation'), ('emission_letter/p', 'cash_status/cancelled') + self.variation_list, ('emission_letter', 'cash_status', 'variation'), ('emission_letter/p', 'cash_status/cancelled') + self.variation_list,
self.quantity_200) self.quantity_200)
# execute tic # execute tic
...@@ -530,7 +582,6 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -530,7 +582,6 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
# get workflow history # get workflow history
workflow_history = self.workflow_tool.getInfoFor(ob=self.monetary_destruction, name='history', wf_id='monetary_destruction_workflow') workflow_history = self.workflow_tool.getInfoFor(ob=self.monetary_destruction, name='history', wf_id='monetary_destruction_workflow')
# check its len is 2 # check its len is 2
self.assertEqual(len(workflow_history), 2)
# check we get an "Insufficient balance" message in the workflow history because of the invalid line # check we get an "Insufficient balance" message in the workflow history because of the invalid line
msg = workflow_history[-1]['error_message'] msg = workflow_history[-1]['error_message']
self.assertTrue('Insufficient balance' in "%s" %(msg,)) self.assertTrue('Insufficient balance' in "%s" %(msg,))
...@@ -565,8 +616,6 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -565,8 +616,6 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
""" """
Confirm the monetary destruction and check it Confirm the monetary destruction and check it
""" """
# fix amount (10000 * 5.0 + 5000 * 24.0)
self.monetary_destruction.setSourceTotalAssetPrice('170000.0')
# do the Workflow action # do the Workflow action
self.workflow_tool.doActionFor(self.monetary_destruction, 'plan_action', wf_id='monetary_destruction_workflow') self.workflow_tool.doActionFor(self.monetary_destruction, 'plan_action', wf_id='monetary_destruction_workflow')
# execute tic # execute tic
...@@ -576,9 +625,6 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -576,9 +625,6 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
# check state is confirmed # check state is confirmed
self.assertEqual(state, 'planned') self.assertEqual(state, 'planned')
# get workflow history # get workflow history
workflow_history = self.workflow_tool.getInfoFor(ob=self.monetary_destruction, name='history', wf_id='monetary_destruction_workflow')
# check len of workflow history is 4
self.assertEqual(len(workflow_history), 4)
def stepCheckSourceDebitPlanned(self, sequence=None, sequence_list=None, **kwd): def stepCheckSourceDebitPlanned(self, sequence=None, sequence_list=None, **kwd):
...@@ -650,15 +696,10 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -650,15 +696,10 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 0.0) self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 0.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 0.0) self.assertEqual(self.simulation_tool.getFutureInventory(node=self.source_for_externe.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 0.0)
def stepPlanMonetaryDestruction(self, sequence=None, sequence_list=None, **kwd): def stepPlanMonetaryDestruction(self, sequence=None, sequence_list=None, **kwd):
""" """
Confirm the monetary_destruction and check it Confirm the monetary_destruction and check it
""" """
# fix amount (10000 * 5.0 + 200 * 12.0)
self.monetary_destruction.setSourceTotalAssetPrice('170000.0')
# do the Workflow action # do the Workflow action
self.workflow_tool.doActionFor(self.monetary_destruction, 'plan_action', wf_id='monetary_destruction_workflow') self.workflow_tool.doActionFor(self.monetary_destruction, 'plan_action', wf_id='monetary_destruction_workflow')
# execute tic # execute tic
...@@ -669,16 +710,19 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -669,16 +710,19 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
self.assertEqual(state, 'planned') self.assertEqual(state, 'planned')
# get workflow history # get workflow history
workflow_history = self.workflow_tool.getInfoFor(ob=self.monetary_destruction, name='history', wf_id='monetary_destruction_workflow') workflow_history = self.workflow_tool.getInfoFor(ob=self.monetary_destruction, name='history', wf_id='monetary_destruction_workflow')
# check len of workflow history is 4
self.assertEqual(len(workflow_history), 4)
def stepSetMonetaryDestructionSourceTotalAssetPrice(self,
sequence=None, sequence_list=None, **kwd):
self.monetary_destruction.setSourceTotalAssetPrice('170000.0')
def stepSetMonetaryDestructionSourceTotalAssetPriceForDematerialization(self,
sequence=None, sequence_list=None, **kwd):
self.monetary_destruction.setSourceTotalAssetPrice('2400.0')
def stepOrderMonetaryDestruction(self, sequence=None, sequence_list=None, **kwd): def stepOrderMonetaryDestruction(self, sequence=None, sequence_list=None, **kwd):
""" """
Confirm the monetary_destruction and check it Confirm the monetary_destruction and check it
""" """
# fix amount (10000 * 5.0 + 200 * 12.0)
self.monetary_destruction.setSourceTotalAssetPrice('170000.0')
# do the Workflow action # do the Workflow action
self.workflow_tool.doActionFor(self.monetary_destruction, 'order_action', wf_id='monetary_destruction_workflow') self.workflow_tool.doActionFor(self.monetary_destruction, 'order_action', wf_id='monetary_destruction_workflow')
# execute tic # execute tic
...@@ -689,15 +733,11 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -689,15 +733,11 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
self.assertEqual(state, 'ordered') self.assertEqual(state, 'ordered')
# get workflow history # get workflow history
workflow_history = self.workflow_tool.getInfoFor(ob=self.monetary_destruction, name='history', wf_id='monetary_destruction_workflow') workflow_history = self.workflow_tool.getInfoFor(ob=self.monetary_destruction, name='history', wf_id='monetary_destruction_workflow')
# check len of workflow history is 4
self.assertEqual(len(workflow_history), 6)
def stepConfirmMonetaryDestruction(self, sequence=None, sequence_list=None, **kwd): def stepConfirmMonetaryDestruction(self, sequence=None, sequence_list=None, **kwd):
""" """
Confirm the monetary_destruction and check it Confirm the monetary_destruction and check it
""" """
# fix amount (10000 * 5.0 + 200 * 12.0)
self.monetary_destruction.setSourceTotalAssetPrice('170000.0')
# do the Workflow action # do the Workflow action
self.workflow_tool.doActionFor(self.monetary_destruction, 'confirm_action', wf_id='monetary_destruction_workflow', stop_date=DateTime()) self.workflow_tool.doActionFor(self.monetary_destruction, 'confirm_action', wf_id='monetary_destruction_workflow', stop_date=DateTime())
# execute tic # execute tic
...@@ -706,10 +746,6 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -706,10 +746,6 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
state = self.monetary_destruction.getSimulationState() state = self.monetary_destruction.getSimulationState()
# check state is confirmed # check state is confirmed
self.assertEqual(state, 'confirmed') self.assertEqual(state, 'confirmed')
# get workflow history
workflow_history = self.workflow_tool.getInfoFor(ob=self.monetary_destruction, name='history', wf_id='monetary_destruction_workflow')
# check len of workflow history is 8
self.assertEqual(len(workflow_history), 8)
def stepConfirmToDeliverMonetaryDestruction(self, sequence=None, sequence_list=None, **kwd): def stepConfirmToDeliverMonetaryDestruction(self, sequence=None, sequence_list=None, **kwd):
""" """
...@@ -725,13 +761,9 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -725,13 +761,9 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
# check that state is delivered # check that state is delivered
self.assertEqual(state, 'delivered') self.assertEqual(state, 'delivered')
# get workflow history # get workflow history
workflow_history = self.workflow_tool.getInfoFor(ob=self.monetary_destruction, name='history', wf_id='monetary_destruction_workflow')
def stepDelMonetaryDestruction(self, sequence=None, sequence_list=None, **kwd): def stepDelMonetaryDestruction(self, sequence=None, sequence_list=None, **kwd):
"""
Delete the invalid vault_transfer line previously create
"""
self.monetary_destruction_module.deleteContent('monetary_destruction_1') self.monetary_destruction_module.deleteContent('monetary_destruction_1')
def stepResetInventory(self, def stepResetInventory(self,
...@@ -769,14 +801,15 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -769,14 +801,15 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
if not run: return if not run: return
sequence_list = SequenceList() sequence_list = SequenceList()
# define the sequence # define the sequence
sequence_string = 'Tic CheckObjects Tic CheckInitialInventory CheckSource ' \ sequence_string = 'Tic CheckObjects Tic CheckInitialInventory ' \
+ 'CreateMonetaryDestruction ' \ + 'CreateMonetaryDestruction ' \
+ 'CreateValidLine1 CheckSubTotal ' \ + 'CreateValidLine1 CheckSubTotal ' \
+ 'CreateValidLine2 CheckTotal ' \ + 'CreateValidLine2 CheckTotal ' \
+ 'CheckSource ' \ + 'CheckInitialInventory ' \
+ 'CreateInvalidLine ' \ + 'CreateInvalidLine ' \
+ 'TryPlannedMonetaryDestructionWithBadInventory ' \ + 'TryPlannedMonetaryDestructionWithBadInventory ' \
+ 'DelInvalidLine Tic CheckTotal ' \ + 'DelInvalidLine Tic CheckTotal ' \
+ 'SetMonetaryDestructionSourceTotalAssetPrice ' \
+ 'PlannedMonetaryDestruction ' \ + 'PlannedMonetaryDestruction ' \
+ 'CheckSourceDebitPlanned ' \ + 'CheckSourceDebitPlanned ' \
+ 'ResetInventory Tic ' \ + 'ResetInventory Tic ' \
...@@ -787,15 +820,16 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -787,15 +820,16 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
+ 'Tic DelMonetaryDestruction Tic' + 'Tic DelMonetaryDestruction Tic'
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
# define the sequence # This is the case of a destruction for another agency
another_sequence_string = 'Tic CheckObjects Tic CheckInitialInventoryForExterne CheckSourceForExterne ' \ another_sequence_string = 'Tic CheckObjects Tic CheckInitialInventoryForExterne ' \
+ 'CreateMonetaryDestructionForExterne ' \ + 'CreateMonetaryDestructionForExterne ' \
+ 'CreateValidLineForExterne1 CheckSubTotal ' \ + 'CreateValidLineForExterne1 CheckSubTotal ' \
+ 'CreateValidLineForExterne2 CheckTotal ' \ + 'CreateValidLineForExterne2 CheckTotal ' \
+ 'CheckSourceForExterne ' \ + 'CheckInitialInventoryForExterne ' \
+ 'CreateInvalidLine ' \ + 'CreateInvalidLine ' \
+ 'TryPlannedMonetaryDestructionWithBadInventory ' \ + 'TryPlannedMonetaryDestructionWithBadInventory ' \
+ 'DelInvalidLine Tic CheckTotal ' \ + 'DelInvalidLine Tic CheckTotal ' \
+ 'SetMonetaryDestructionSourceTotalAssetPrice ' \
+ 'PlanMonetaryDestruction ' \ + 'PlanMonetaryDestruction ' \
+ 'CheckSourceDebitPlannedForExterne ' \ + 'CheckSourceDebitPlannedForExterne ' \
+ 'OrderMonetaryDestruction ' \ + 'OrderMonetaryDestruction ' \
...@@ -804,7 +838,25 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -804,7 +838,25 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
+ 'DeliverFails ' \ + 'DeliverFails ' \
+ 'DeleteResetInventory Tic ' \ + 'DeleteResetInventory Tic ' \
+ 'ConfirmToDeliverMonetaryDestruction ' \ + 'ConfirmToDeliverMonetaryDestruction ' \
+ 'CheckSourceDebitForExterne ' + 'CheckSourceDebitForExterne ' \
+ 'Tic DelMonetaryDestruction Tic '
sequence_list.addSequenceString(another_sequence_string)
# We will now do a dematerialization
# It will be the same workflow validation as the destruction for
# another agency
another_sequence_string = 'Tic CheckObjects Tic ' \
+ 'CheckInitialInventoryForDematerialization ' \
+ 'CreateMonetaryDestructionForDematerialization ' \
+ 'CreateValidLineForDematerialization ' \
+ 'CheckInitialInventoryForDematerialization ' \
+ 'SetMonetaryDestructionSourceTotalAssetPriceForDematerialization ' \
+ 'PlanMonetaryDestruction ' \
+ 'OrderMonetaryDestruction ' \
+ 'ConfirmMonetaryDestruction ' \
+ 'ConfirmToDeliverMonetaryDestruction ' \
+ 'CheckFinalInventoryForDematerialization '
sequence_list.addSequenceString(another_sequence_string) sequence_list.addSequenceString(another_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