[Erp5-report] r8105 - /erp5/trunk/products/ERP5Banking/tests/
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Jun 20 18:14:01 CEST 2006
Author: seb
Date: Tue Jun 20 18:13:58 2006
New Revision: 8105
URL: http://svn.erp5.org?rev=8105&view=rev
Log:
improvement of 3 unit tests, some cases where missing
Modified:
erp5/trunk/products/ERP5Banking/tests/testERP5BankingCounterRendering.py
erp5/trunk/products/ERP5Banking/tests/testERP5BankingMonetaryRecall.py
erp5/trunk/products/ERP5Banking/tests/testERP5BankingMoneyDepositRendering.py
Modified: erp5/trunk/products/ERP5Banking/tests/testERP5BankingCounterRendering.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Banking/tests/testERP5BankingCounterRendering.py?rev=8105&r1=8104&r2=8105&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Banking/tests/testERP5BankingCounterRendering.py (original)
+++ erp5/trunk/products/ERP5Banking/tests/testERP5BankingCounterRendering.py Tue Jun 20 18:13:58 2006
@@ -105,7 +105,7 @@
, 'erp5_accounting'
, 'erp5_banking_core' # erp5_banking_core contains all generic methods for banking
, 'erp5_banking_inventory'
- , 'erp5_banking_cash'
+ , 'erp5_banking_cash' # erp5_banking_cash contains all method for counter rendering
)
def getCounterRenderingModule(self):
@@ -137,13 +137,13 @@
inventory_dict_line_1 = {'id' : 'inventory_line_1',
'resource': self.billet_10000,
'variation_id': ('emission_letter', 'cash_status', 'variation'),
- 'variation_value': ('emission_letter/p', 'cash_status/valid') + self.variation_list,
+ 'variation_value': ('emission_letter/p', 'cash_status/not_defined') + self.variation_list,
'quantity': self.quantity_10000}
inventory_dict_line_2 = {'id' : 'inventory_line_2',
'resource': self.piece_200,
'variation_id': ('emission_letter', 'cash_status', 'variation'),
- 'variation_value': ('emission_letter/p', 'cash_status/valid') + self.variation_list,
+ '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]
@@ -231,7 +231,7 @@
"""
# create the counter rendering line
self.addCashLineToDelivery(self.counter_rendering, 'valid_line_1', 'Cash Delivery 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/not_defined') + self.variation_list,
self.quantity_10000)
# execute tic
self.stepTic()
@@ -252,7 +252,7 @@
# now check for each variation (years 1992 and 2003)
for variation in self.variation_list:
# 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/not_defined')
# chek portal types
self.assertEqual(cell.getPortalType(), 'Cash Delivery Cell')
# check the banknote of the cell is banknote of 10000
@@ -289,7 +289,7 @@
"""
# create the line
self.addCashLineToDelivery(self.counter_rendering, 'valid_line_2', 'Cash Delivery 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/not_defined') + self.variation_list,
self.quantity_200)
# execute tic
self.stepTic()
@@ -309,7 +309,7 @@
self.assertEqual(len(self.valid_line_2.objectValues()), 2)
for variation in self.variation_list:
# 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/not_defined')
# check the portal type
self.assertEqual(cell.getPortalType(), 'Cash Delivery Cell')
if cell.getId() == 'movement_0_0_0':
@@ -330,7 +330,7 @@
# 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
self.addCashLineToDelivery(self.counter_rendering, 'invalid_line', 'Cash Delivery 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/not_defined') + self.variation_list,
self.quantity_5000)
# execute tic
self.stepTic()
@@ -452,6 +452,11 @@
# check len of len workflow history is 6
self.assertEqual(len(workflow_history), 6)
+ def stepCheckBaobabDestination(self, sequence=None, sequence_list=None, **kwd):
+ """
+ Check destination vault equal site/testsite/paris/surface/caisse_courante/encaisse_des_billets_et_monnaies
+ """
+ self.assertEqual(self.counter_rendering.getBaobabDestination(), 'site/testsite/paris/surface/caisse_courante/encaisse_des_billets_et_monnaies')
def stepCheckSourceDebit(self, sequence=None, sequence_list=None, **kwd):
"""
@@ -490,6 +495,7 @@
# define the sequence
sequence_string = 'Tic CheckObjects Tic CheckInitialInventory CheckSource CheckDestination ' \
+ 'CreateCounterRendering ' \
+ + 'Tic CheckBaobabDestination ' \
+ 'CreateValidLine1 CheckSubTotal ' \
+ 'CreateValidLine2 CheckTotal ' \
+ 'CheckSource CheckDestination ' \
Modified: erp5/trunk/products/ERP5Banking/tests/testERP5BankingMonetaryRecall.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Banking/tests/testERP5BankingMonetaryRecall.py?rev=8105&r1=8104&r2=8105&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Banking/tests/testERP5BankingMonetaryRecall.py (original)
+++ erp5/trunk/products/ERP5Banking/tests/testERP5BankingMonetaryRecall.py Tue Jun 20 18:13:58 2006
@@ -105,7 +105,7 @@
, 'erp5_accounting'
, 'erp5_banking_core' # erp5_banking_core contains all generic methods for banking
, 'erp5_banking_inventory'
- , 'erp5_banking_cash'
+ , 'erp5_banking_cash' # erp5_banking_cash contains all method for monetary recall
)
def getMonetaryRecallModule(self):
@@ -236,7 +236,7 @@
Create the monetary recall line 1 with banknotes of 10000 and check it has been well created
"""
# create the monetary recall line
- self.addCashLineToDelivery(self.monetary_recall, 'valid_line_1', 'Cash Delivery Line', self.billet_10000,
+ self.addCashLineToDelivery(self.monetary_recall, 'valid_line_1', 'Monetary Recall Line', self.billet_10000,
('emission_letter', 'cash_status', 'variation'), ('emission_letter/p', 'cash_status/cancelled') + self.variation_list,
self.quantity_10000)
# execute tic
@@ -246,7 +246,7 @@
# get the monetary recall line
self.valid_line_1 = getattr(self.monetary_recall, 'valid_line_1')
# check its portal type
- self.assertEqual(self.valid_line_1.getPortalType(), 'Cash Delivery Line')
+ self.assertEqual(self.valid_line_1.getPortalType(), 'Monetary Recall Line')
# check the resource is banknotes of 10000
self.assertEqual(self.valid_line_1.getResourceValue(), self.billet_10000)
# chek the value of the banknote
@@ -260,7 +260,7 @@
# get the delivery cell
cell = self.valid_line_1.getCell('emission_letter/p', variation, 'cash_status/cancelled')
# chek portal types
- self.assertEqual(cell.getPortalType(), 'Cash Delivery Cell')
+ self.assertEqual(cell.getPortalType(), 'Monetary Recall Cell')
# check the banknote of the cell is banknote of 10000
self.assertEqual(cell.getResourceValue(), self.billet_10000)
# check the source vault is cash
@@ -294,7 +294,7 @@
Create the monetary recall line 2 wiht coins of 200 and check it has been well created
"""
# create the line
- self.addCashLineToDelivery(self.monetary_recall, 'valid_line_2', 'Cash Delivery Line', self.piece_200,
+ self.addCashLineToDelivery(self.monetary_recall, 'valid_line_2', 'Monetary Recall Line', self.piece_200,
('emission_letter', 'cash_status', 'variation'), ('emission_letter/p', 'cash_status/cancelled') + self.variation_list,
self.quantity_200)
# execute tic
@@ -304,7 +304,7 @@
# get the second monetary recall line
self.valid_line_2 = getattr(self.monetary_recall, 'valid_line_2')
# check portal types
- self.assertEqual(self.valid_line_2.getPortalType(), 'Cash Delivery Line')
+ self.assertEqual(self.valid_line_2.getPortalType(), 'Monetary Recall Line')
# check the resource is coin of 200
self.assertEqual(self.valid_line_2.getResourceValue(), self.piece_200)
# check the value of coin
@@ -317,7 +317,7 @@
# get the delivery cell
cell = self.valid_line_2.getCell('emission_letter/p', variation, 'cash_status/cancelled')
# check the portal type
- self.assertEqual(cell.getPortalType(), 'Cash Delivery Cell')
+ self.assertEqual(cell.getPortalType(), 'Monetary Recall Cell')
if cell.getId() == 'movement_0_0_0':
# check the quantity for coin for year 1992 is 5
self.assertEqual(cell.getQuantity(), 5.0)
@@ -335,7 +335,7 @@
"""
# 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 cash has no banknote of 5000
- self.addCashLineToDelivery(self.monetary_recall, 'invalid_line', 'Cash Delivery Line', self.billet_5000,
+ self.addCashLineToDelivery(self.monetary_recall, 'invalid_line', 'Monetary Recall Line', self.billet_5000,
('emission_letter', 'cash_status', 'variation'), ('emission_letter/p', 'cash_status/cancelled') + self.variation_list,
self.quantity_5000)
# execute tic
@@ -369,6 +369,7 @@
self.assertEqual(len(workflow_history), 2)
# check we get an "Insufficient balance" message in the workflow history because of the invalid line
msg = workflow_history[-1]['error_message']
+ #import pdb;pdb.set_trace()
self.assertEqual('Insufficient Balance.', "%s" %(msg,))
@@ -482,6 +483,18 @@
# check we have 12 coins of 200
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.counter.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 12.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.counter.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 12.0)
+
+
+ def stepCheckCashDeliveryLine(self, sequence=None, sequence_list=None):
+ """
+ Check the cash delivery line
+ """
+ variation = 'variation/2003'
+ # get the delivery cell
+ cell = self.valid_line_1.getCell('emission_letter/p', variation, 'cash_status/cancelled')
+ # check the destination variation text is redefine on destination
+ #import pdb;pdb.set_trace()
+ self.assertEqual(cell.getBaobabDestinationVariationText(), 'cash_status/retired\nemission_letter/p\nvariation/2003')
##################################
@@ -507,7 +520,7 @@
+ 'CheckSourceDebitPlanned CheckDestinationCreditPlanned ' \
+ 'CheckSourceDebitPlanned CheckDestinationCreditPlanned ' \
+ 'DeliverMonetaryRecall ' \
- + 'CheckSourceDebit CheckDestinationCredit '
+ + 'CheckSourceDebit CheckDestinationCredit CheckCashDeliveryLine '
sequence_list.addSequenceString(sequence_string)
# play the sequence
sequence_list.play(self)
Modified: erp5/trunk/products/ERP5Banking/tests/testERP5BankingMoneyDepositRendering.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Banking/tests/testERP5BankingMoneyDepositRendering.py?rev=8105&r1=8104&r2=8105&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Banking/tests/testERP5BankingMoneyDepositRendering.py (original)
+++ erp5/trunk/products/ERP5Banking/tests/testERP5BankingMoneyDepositRendering.py Tue Jun 20 18:13:58 2006
@@ -36,7 +36,6 @@
from Products.DCWorkflow.DCWorkflow import Unauthorized, ValidationFailed
from Testing.ZopeTestCase.PortalTestCase import PortalTestCase
from Products.ERP5Banking.tests.TestERP5BankingMixin import TestERP5BankingMixin
-from zLOG import LOG
# Needed in order to have a log file inside the current folder
os.environ['EVENT_LOG_FILE'] = os.path.join(os.getcwd(), 'zLOG.log')
@@ -106,7 +105,7 @@
, 'erp5_accounting'
, 'erp5_banking_core' # erp5_banking_core contains all generic methods for banking
, 'erp5_banking_inventory'
- , 'erp5_banking_cash'
+ , 'erp5_banking_cash' # erp5_banking_cash contains all method for money deposit rendering
)
def getMoneyDepositRenderingModule(self):
@@ -138,13 +137,13 @@
inventory_dict_line_1 = {'id' : 'inventory_line_1',
'resource': self.billet_10000,
'variation_id': ('emission_letter', 'cash_status', 'variation'),
- 'variation_value': ('emission_letter/p', 'cash_status/valid') + self.variation_list,
+ 'variation_value': ('emission_letter/p', 'cash_status/not_defined') + self.variation_list,
'quantity': self.quantity_10000}
inventory_dict_line_2 = {'id' : 'inventory_line_2',
'resource': self.piece_200,
'variation_id': ('emission_letter', 'cash_status', 'variation'),
- 'variation_value': ('emission_letter/p', 'cash_status/valid') + self.variation_list,
+ '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]
@@ -204,13 +203,18 @@
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.auxiliaire.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 0.0)
+ def stepCheckBaobabDestination(self, sequence=None, sequence_list=None, **kwd):
+ """
+ Check destination vault equal site/testsite/paris/caveau/auxiliaire/encaisse_des_billets_et_monnaies
+ """
+ self.assertEqual(self.money_deposit_rendering.getBaobabDestination(), 'site/testsite/paris/caveau/auxiliaire/encaisse_des_billets_et_monnaies')
+
def stepCreateMoneyDepositRendering(self, sequence=None, sequence_list=None, **kwd):
"""
Create a money deposit rendering document and check it
"""
# Money deposit rendering has auxiliaire for source, gros_versement for destination, and a price cooreponding to the sum of banknote of 10000 abd coin of 200 ( (2+3) * 1000 + (5+7) * 200 )
- LOG('money_deposit_rendering_module.showDict()',0,self.money_deposit_rendering_module.showDict())
self.money_deposit_rendering = self.money_deposit_rendering_module.newContent(id='money_deposit_rendering_1', portal_type='Money Deposit Rendering', source_value=self.gros_versement, source_total_asset_price=52400.0)
# execute tic
self.stepTic()
@@ -233,7 +237,7 @@
"""
# create the money deposit rendering line
self.addCashLineToDelivery(self.money_deposit_rendering, 'valid_line_1', 'Cash Delivery 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/not_defined') + self.variation_list,
self.quantity_10000)
# execute tic
self.stepTic()
@@ -254,7 +258,7 @@
# now check for each variation (years 1992 and 2003)
for variation in self.variation_list:
# 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/not_defined')
# chek portal types
self.assertEqual(cell.getPortalType(), 'Cash Delivery Cell')
# check the banknote of the cell is banknote of 10000
@@ -291,7 +295,7 @@
"""
# create the line
self.addCashLineToDelivery(self.money_deposit_rendering, 'valid_line_2', 'Cash Delivery 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/not_defined') + self.variation_list,
self.quantity_200)
# execute tic
self.stepTic()
@@ -311,7 +315,7 @@
self.assertEqual(len(self.valid_line_2.objectValues()), 2)
for variation in self.variation_list:
# 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/not_defined')
# check the portal type
self.assertEqual(cell.getPortalType(), 'Cash Delivery Cell')
if cell.getId() == 'movement_0_0_0':
@@ -332,7 +336,7 @@
# 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 auxiliaire has no banknote of 5000
self.addCashLineToDelivery(self.money_deposit_rendering, 'invalid_line', 'Cash Delivery 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/not_defined') + self.variation_list,
self.quantity_5000)
# execute tic
self.stepTic()
@@ -536,6 +540,7 @@
# define the sequence
sequence_string = 'Tic CheckObjects Tic CheckInitialInventory CheckSource CheckDestination ' \
+ 'CreateMoneyDepositRendering ' \
+ + 'Tic CheckBaobabDestination ' \
+ 'CreateValidLine1 CheckSubTotal ' \
+ 'CreateValidLine2 CheckTotal ' \
+ 'CheckSource CheckDestination ' \
More information about the Erp5-report
mailing list