Commit ff1d92e8 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Normalize whitespaces.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31799 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 447e9a29
......@@ -58,7 +58,7 @@ class TestERP5BankingMixin(ERP5TypeTestCase):
'erp5_banking_core',
'erp5_banking_inventory',
'erp5_banking_cash',
'erp5_banking_check',)
'erp5_banking_check')
def enableLightInstall(self):
"""
......@@ -316,7 +316,7 @@ class TestERP5BankingMixin(ERP5TypeTestCase):
currency = self.getCurrencyModule()[currency_id]
exchange_line = None
exchange_line = currency.newContent(portal_type='Currency Exchange Line',
start_date='01/01/1900',stop_date='01/01/2900',
start_date='01/01/1900', stop_date='01/01/2900',
base_price=base_price,
currency_exchange_type_list=['currency_exchange_type/sale',
'currency_exchange_type/purchase',
......@@ -324,7 +324,7 @@ class TestERP5BankingMixin(ERP5TypeTestCase):
)
exchange_line.setPriceCurrencyValue(self.getCurrencyModule()[price_currency])
cell_list = exchange_line.objectValues()
self.assertEquals(len(cell_list),3)
self.assertEquals(len(cell_list), 3)
for cell in cell_list:
cell.setBasePrice(cell_price)
......@@ -340,7 +340,7 @@ class TestERP5BankingMixin(ERP5TypeTestCase):
# Define static values (only use prime numbers to prevent confusions like 2 * 6 == 3 * 4)
# variation list is the list of years for banknotes and coins
self.variation_list = ('variation/1992', 'variation/2003')
self.usd_variation_list = ('variation/not_defined',)
self.usd_variation_list = ('variation/not_defined', )
# quantity of banknotes of 10000 :
self.quantity_10000 = {}
# 2 banknotes of 10000 for the year 1992
......@@ -463,22 +463,22 @@ class TestERP5BankingMixin(ERP5TypeTestCase):
# create document for banknote of 100 USD
self.usd_billet_100 = self.currency_cash_module.newContent(id='usd_billet_100',
portal_type='Banknote', base_price=100,
price_currency_value=self.currency_2, variation_list=('not_defined',),
price_currency_value=self.currency_2, variation_list=('not_defined', ),
quantity_unit_value=self.unit)
# create document for banknote of 200 USD
self.usd_billet_200 = self.currency_cash_module.newContent(id='usd_billet_200',
portal_type='Banknote', base_price=200,
price_currency_value=self.currency_2, variation_list=('not_defined',),
price_currency_value=self.currency_2, variation_list=('not_defined', ),
quantity_unit_value=self.unit)
# create document for banknote of 50 USD
self.usd_billet_50 = self.currency_cash_module.newContent(id='usd_billet_50',
portal_type='Banknote', base_price=50,
price_currency_value=self.currency_2, variation_list=('not_defined',),
price_currency_value=self.currency_2, variation_list=('not_defined', ),
quantity_unit_value=self.unit)
# create document for banknote of 20 USD
self.usd_billet_20 = self.currency_cash_module.newContent(id='usd_billet_20',
portal_type='Banknote', base_price=20,
price_currency_value=self.currency_2, variation_list=('not_defined',),
price_currency_value=self.currency_2, variation_list=('not_defined', ),
quantity_unit_value=self.unit)
def createFunctionGroupSiteCategory(self, no_site=0, site_list=None):
......@@ -495,7 +495,7 @@ class TestERP5BankingMixin(ERP5TypeTestCase):
self.category_tool.role.newContent(id='internal', portal_type='Category')
# add category for currency_exchange_type
self.currency_exchange_type = getattr(self.category_tool,'currency_exchange_type')
self.currency_exchange_type = getattr(self.category_tool, 'currency_exchange_type')
self.currency_exchange_type.newContent(id='sale')
self.currency_exchange_type.newContent(id='purchase')
self.currency_exchange_type.newContent(id='transfer')
......@@ -537,7 +537,7 @@ class TestERP5BankingMixin(ERP5TypeTestCase):
# get the base category site
self.site_base_category = getattr(self.category_tool, 'site')
# add the category testsite in the category site which hold vaults situated in the bank
self.testsite = self.site_base_category.newContent(id='testsite', portal_type='Category',codification='TEST')
self.testsite = self.site_base_category.newContent(id='testsite', portal_type='Category', codification='TEST')
site_reference_from_codification_dict = {
'P10': ('FR', '000', '11111', '000000000000', '25'),
'S10': ('SP', '000', '11111', '000000000000', '08'),
......@@ -647,58 +647,58 @@ class TestERP5BankingMixin(ERP5TypeTestCase):
vault_codification += 'GV'
elif s == 'gros_paiement':
vault_codification += 'GP'
s = surface.newContent(id='%s' %(s,), portal_type='Category', codification=vault_codification, vault_type='site/surface/%s' %(s,))
s = surface.newContent(id='%s' % (s, ), portal_type='Category', codification=vault_codification, vault_type='site/surface/%s' % (s, ))
for ss in ['guichet_1', 'guichet_2']:
final_vault_codification = vault_codification + ss[-1]
ss = s.newContent(id='%s' %(ss,), portal_type='Category', codification=final_vault_codification, vault_type='site/surface/%s/guichet' %(s.getId(),))
for sss in ['encaisse_des_billets_et_monnaies',]:
sss = ss.newContent(id='%s' %(sss,), portal_type='Category', codification='', vault_type='site/surface/%s/guichet' %(s.getId(),))
ss = s.newContent(id='%s' % (ss, ), portal_type='Category', codification=final_vault_codification, vault_type='site/surface/%s/guichet' % (s.getId(), ))
for sss in ['encaisse_des_billets_et_monnaies']:
sss = ss.newContent(id='%s' % (sss, ), portal_type='Category', codification='', vault_type='site/surface/%s/guichet' % (s.getId(), ))
for ssss in ['entrante', 'sortante']:
sss.newContent(id='%s' %(ssss,), portal_type='Category', codification='', vault_type='site/surface/%s/guichet' %(s.getId(),))
for sss in ['encaisse_des_devises',]:
sss = ss.newContent(id='%s' %(sss,), portal_type='Category', codification='', vault_type='site/surface/%s/guichet' %(s.getId(),))
sss.newContent(id='%s' % (ssss, ), portal_type='Category', codification='', vault_type='site/surface/%s/guichet' % (s.getId(), ))
for sss in ['encaisse_des_devises']:
sss = ss.newContent(id='%s' % (sss, ), portal_type='Category', codification='', vault_type='site/surface/%s/guichet' % (s.getId(), ))
for currency in ['usd']:
currency_cat = sss.newContent(id='%s' %(currency,), portal_type='Category', codification='', vault_type='site/surface/%s' %(ss.getId(),))
currency_cat = sss.newContent(id='%s' % (currency, ), portal_type='Category', codification='', vault_type='site/surface/%s' % (ss.getId(), ))
for ssss in ['entrante', 'sortante']:
currency_cat.newContent(id='%s' %(ssss,), portal_type='Category', codification='', vault_type='site/surface/%s/guichet' %(s.getId(),))
currency_cat.newContent(id='%s' % (ssss, ), portal_type='Category', codification='', vault_type='site/surface/%s/guichet' % (s.getId(), ))
# create sort room
salle_tri = surface.newContent(id='salle_tri', portal_type='Category', codification='', vault_type='site/surface/salle_tri')
for ss in ['encaisse_des_billets_et_monnaies', 'encaisse_des_billets_recus_pour_ventilation', 'encaisse_des_differences', 'encaisse_des_externes']:
ss = salle_tri.newContent(id='%s' %(ss,), portal_type='Category', codification='', vault_type='site/surface/salle_tri')
ss = salle_tri.newContent(id='%s' % (ss, ), portal_type='Category', codification='', vault_type='site/surface/salle_tri')
if 'ventilation' in ss.getId():
for country in destination_site_list:
if country[0] != c.getCodification()[0]:
ss.newContent(id='%s' %(country,), portal_type='Category', codification='', vault_type='site/caveau/%s' %(s.getId(),))
ss.newContent(id='%s' % (country, ), portal_type='Category', codification='', vault_type='site/caveau/%s' % (s.getId(), ))
# caveau
caveau = c.newContent(id='caveau', portal_type='Category', codification='', vault_type='site/caveau')
for s in ['auxiliaire', 'reserve', 'serre']:
s = caveau.newContent(id='%s' %(s,), portal_type='Category', codification='', vault_type='site/caveau/%s' %(s,))
s = caveau.newContent(id='%s' % (s, ), portal_type='Category', codification='', vault_type='site/caveau/%s' % (s, ))
if s.getId() == 'serre':
for ss in ['encaisse_des_billets_neufs_non_emis', 'encaisse_des_billets_retires_de_la_circulation','encaisse_des_billets_detruits','encaisse_des_billets_neufs_non_emis_en_transit_allant_a']:
ss = s.newContent(id='%s' %(ss,), portal_type='Category', codification='', vault_type='site/caveau/%s' %(s.getId(),))
for ss in ['encaisse_des_billets_neufs_non_emis', 'encaisse_des_billets_retires_de_la_circulation', 'encaisse_des_billets_detruits', 'encaisse_des_billets_neufs_non_emis_en_transit_allant_a']:
ss = s.newContent(id='%s' % (ss, ), portal_type='Category', codification='', vault_type='site/caveau/%s' % (s.getId(), ))
if 'transit' in ss.getId():
for country in destination_site_list:
if country[0] != c.getCodification()[0]:
ss.newContent(id='%s' %(country,), portal_type='Category', codification='', vault_type='site/caveau/%s' %(s.getId(),))
ss.newContent(id='%s' % (country, ), portal_type='Category', codification='', vault_type='site/caveau/%s' % (s.getId(), ))
else:
for ss in ['encaisse_des_billets_et_monnaies', 'encaisse_des_externes',
'encaisse_des_billets_recus_pour_ventilation','encaisse_des_devises']:
ss = s.newContent(id='%s' %(ss,), portal_type='Category', codification='', vault_type='site/caveau/%s' %(s.getId(),))
'encaisse_des_billets_recus_pour_ventilation', 'encaisse_des_devises']:
ss = s.newContent(id='%s' % (ss, ), portal_type='Category', codification='', vault_type='site/caveau/%s' % (s.getId(), ))
if 'ventilation' in ss.getId():
for country in destination_site_list:
if country[0] != c.getCodification()[0]:
ss.newContent(id='%s' %(country,), portal_type='Category', codification='', vault_type='site/caveau/%s' %(s.getId(),))
ss.newContent(id='%s' % (country, ), portal_type='Category', codification='', vault_type='site/caveau/%s' % (s.getId(), ))
if 'devises' in ss.getId():
for currency in ['eur','usd']:
ss.newContent(id='%s' %(currency,), portal_type='Category', codification='', vault_type='site/caveau/%s' %(ss.getId(),))
for currency in ['eur', 'usd']:
ss.newContent(id='%s' % (currency, ), portal_type='Category', codification='', vault_type='site/caveau/%s' % (ss.getId(), ))
if 'encaisse_des_externes' in ss.getId():
ss.newContent(id='transit', portal_type='Category', codification='', vault_type='site/caveau/%s' %(s.getId(),))
ss.newContent(id='transit', portal_type='Category', codification='', vault_type='site/caveau/%s' % (s.getId(), ))
#if ss.getId()=='encaisse_des_devises':
# for
if s.getId() == 'auxiliaire':
for ss in ['encaisse_des_billets_a_ventiler_et_a_detruire', 'encaisse_des_billets_ventiles_et_detruits', 'billets_detenus_par_des_tiers', 'encaisse_des_billets_recus_pour_ventilation_venant_de']:
s.newContent(id='%s' %(ss,), portal_type='Category', codification='', vault_type='site/caveau/%s' %(s.getId(),))
s.newContent(id='%s' % (ss, ), portal_type='Category', codification='', vault_type='site/caveau/%s' % (s.getId(), ))
# Create forreing currency entries in encaisse_des_devises.
for currency in ['usd', ]:
caisse_courante.encaisse_des_devises.newContent(id=currency, portal_type='Category', codification='', vault_type='site/surface/caisse_courante/encaisse_des_devises')
......@@ -784,7 +784,7 @@ class TestERP5BankingMixin(ERP5TypeTestCase):
else:
self.portal._updateProperty('not_working_days', "")
setattr(self.portal,'functionnal_test_mode',1)
setattr(self.portal, 'functionnal_test_mode', 1)
# the person module
self.person_module = self.getPersonModule()
# the organisation module
......@@ -818,12 +818,12 @@ class TestERP5BankingMixin(ERP5TypeTestCase):
doc.Baobab_getUniqueReference()
def createPerson(self, id, first_name, last_name,site=None):
def createPerson(self, id, first_name, last_name, site=None):
"""
Create a person
"""
if site is None:
site="testsite/paris"
site = "testsite/paris"
return self.person_module.newContent(id = id,
portal_type = 'Person',
first_name = first_name,
......@@ -846,7 +846,7 @@ class TestERP5BankingMixin(ERP5TypeTestCase):
if not kw.has_key('bank_account_key'):
kw['bank_account_key'] = '12'
if not kw.has_key('internal_bank_account_number'):
kw['internal_bank_account_number'] = 'k%11s' %(12341234512 + self.account_inventory_number,)
kw['internal_bank_account_number'] = 'k%11s' % (12341234512 + self.account_inventory_number, )
#kw['internal_bank_account_number'] = 'k12341234512'
bank_account = person.newContent(id = account_id,
portal_type = 'Bank Account',
......@@ -881,7 +881,7 @@ class TestERP5BankingMixin(ERP5TypeTestCase):
portal_type='Bank Account Inventory',
destination_payment_value=bank_account,
stop_date=inv_date)
account_inventory_line_id = 'account_inventory_line_%s' %(self.account_inventory_number,)
account_inventory_line_id = 'account_inventory_line_%s' % (self.account_inventory_number, )
inventory_line = inventory.newContent(id=account_inventory_line_id,
portal_type='Bank Account Inventory Line',
resource_value=bank_account.getPriceCurrencyValue(),
......@@ -919,12 +919,12 @@ class TestERP5BankingMixin(ERP5TypeTestCase):
account_number_enabled=True,
reference=reference,
composition=check_model.getRelativeUrl())
model.newContent(id='variant_1',portal_type='Checkbook Model Check Amount Variation',
quantity=50,title='50')
model.newContent(id='variant_2',portal_type='Checkbook Model Check Amount Variation',
quantity=100,title='100')
model.newContent(id='variant_3',portal_type='Checkbook Model Check Amount Variation',
quantity=200,title='200')
model.newContent(id='variant_1', portal_type='Checkbook Model Check Amount Variation',
quantity=50, title='50')
model.newContent(id='variant_2', portal_type='Checkbook Model Check Amount Variation',
quantity=100, title='100')
model.newContent(id='variant_3', portal_type='Checkbook Model Check Amount Variation',
quantity=200, title='200')
return model
......@@ -993,7 +993,7 @@ class TestERP5BankingMixin(ERP5TypeTestCase):
reference, range_start, range_stop, quantity, aggregate
"""
# Container Creation
base_list=('emission_letter', 'variation', 'cash_status')
base_list = ('emission_letter', 'variation', 'cash_status')
category_list = ('emission_letter/'+global_dict['emission_letter'], 'variation/'+global_dict['variation'], 'cash_status/'+global_dict['cash_status'] )
resource_total_quantity = 0
# create cash container
......@@ -1005,7 +1005,7 @@ class TestERP5BankingMixin(ERP5TypeTestCase):
, cash_number_range_stop = line_dict['range_stop']
)
if line_dict.has_key('aggregate'):
movement_container.setAggregateValueList([line_dict['aggregate'],])
movement_container.setAggregateValueList([line_dict['aggregate'], ])
# create a cash container line
container_line = movement_container.newContent(portal_type = 'Container Line'
, reindex_object = 1
......@@ -1014,13 +1014,13 @@ class TestERP5BankingMixin(ERP5TypeTestCase):
)
container_line.setResourceValue(global_dict['resource'])
container_line.setVariationCategoryList(category_list)
container_line.updateCellRange(script_id='CashDetail_asCellRange',base_id="movement")
container_line.updateCellRange(script_id='CashDetail_asCellRange', base_id="movement")
for key in container_line.getCellKeyList(base_id='movement'):
if isSameSet(key,category_list):
if isSameSet(key, category_list):
cell = container_line.newCell(*key)
cell.setCategoryList(category_list)
cell.setQuantity(line_dict['quantity'])
cell.setMappedValuePropertyList(['quantity','price'])
cell.setMappedValuePropertyList(['quantity', 'price'])
cell.setMembershipCriterionBaseCategoryList(base_list)
cell.setMembershipCriterionCategoryList(category_list)
cell.edit(force_update = 1,
......@@ -1038,18 +1038,18 @@ class TestERP5BankingMixin(ERP5TypeTestCase):
movement_line.setVariationCategoryList(category_list)
movement_line.updateCellRange(script_id="CashDetail_asCellRange", base_id="movement")
for key in movement_line.getCellKeyList(base_id='movement'):
if isSameSet(key,category_list):
if isSameSet(key, category_list):
cell = movement_line.newCell(*key)
cell.setCategoryList(category_list)
cell.setQuantity(resource_total_quantity)
cell.setMappedValuePropertyList(['quantity','price'])
cell.setMappedValuePropertyList(['quantity', 'price'])
cell.setMembershipCriterionBaseCategoryList(base_list)
cell.setMembershipCriterionCategoryList(category_list)
cell.edit(force_update = 1,
price = movement_line.getResourceValue().getBasePrice())
def createCashInventory(self, source, destination, currency, line_list=[],extra_id='',
def createCashInventory(self, source, destination, currency, line_list=[], extra_id='',
reset_quantity=0, start_date=None, quantity_factor=1):
"""
Create a cash inventory group
......@@ -1057,7 +1057,7 @@ class TestERP5BankingMixin(ERP5TypeTestCase):
# we need to have a unique inventory group id by destination
inventory_group_id = 'inventory_group_%s_%s%s' % \
(destination.getParentValue().getUid(),destination.getId(),extra_id)
(destination.getParentValue().getUid(), destination.getId(), extra_id)
if start_date is None:
start_date = DateTime()-1
if not hasattr(self, inventory_group_id):
......@@ -1070,7 +1070,7 @@ class TestERP5BankingMixin(ERP5TypeTestCase):
inventory_group = getattr(self, inventory_group_id)
# get/create the inventory based on currency
inventory_id = '%s_inventory_%s' %(inventory_group_id,currency.getId())
inventory_id = '%s_inventory_%s' % (inventory_group_id, currency.getId())
if not hasattr(self, inventory_id):
inventory = inventory_group.newContent(id=inventory_id,
portal_type='Cash Inventory',
......@@ -1086,7 +1086,7 @@ class TestERP5BankingMixin(ERP5TypeTestCase):
# variation_value : list of variation value (must be in the same order as variation_id
# quantity
for line in line_list:
variation_list = line.get('variation_list',None)
variation_list = line.get('variation_list', None)
self.addCashLineToDelivery(inventory,
line['id'],
"Cash Inventory Line",
......@@ -1194,7 +1194,7 @@ class TestERP5BankingMixin(ERP5TypeTestCase):
extra_id = '_reset'
# Before the test, we need to input the inventory
self.createCashInventory(source=None, destination=destination, currency=currency,
line_list=line_list,extra_id=extra_id, reset_quantity=1,
line_list=line_list, extra_id=extra_id, reset_quantity=1,
start_date=start_date)
def stepDeleteResetInventory(self, sequence=None, sequence_list=None, **kwd):
......
......@@ -92,7 +92,7 @@ class TestERP5BankingAvailableInventory(TestERP5BankingCheckPaymentMixin,
currency=self.currency_1,
line_list=self.line_list)
self.openCounter(site=self.money_deposit_counter.guichet_1,id='counter_2')
self.openCounter(site=self.money_deposit_counter.guichet_1, id='counter_2')
# Define foreign currency variables
inventory_dict_line_1 = {'id' : 'inventory_line_1',
......@@ -119,36 +119,36 @@ class TestERP5BankingAvailableInventory(TestERP5BankingCheckPaymentMixin,
"""
Make sure we can not open the counter date twice
"""
self.openCounterDate(site=self.paris,id='counter_date_2',open=0)
self.openCounterDate(site=self.paris, id='counter_date_2', open=0)
# open counter date and counter
self.assertRaises(ValidationFailed,
self.workflow_tool.doActionFor,
self.counter_date_2,'open_action',
self.counter_date_2, 'open_action',
wf_id='counter_date_workflow')
# get workflow history
workflow_history = self.workflow_tool.getInfoFor(
ob=self.counter_date_2, name='history', wf_id='counter_date_workflow')
# check its len is 2
msg = workflow_history[-1]['error_message']
self.assertTrue('there is already a counter date opened' in "%s" %(msg,))
self.assertTrue('there is already a counter date opened' in "%s" % (msg, ))
def stepCheckOpenCounterDateTwiceWithOtherDateFail(self, sequence=None, sequence_list=None, **kwd):
"""
Make sure we can not open the counter date twice
"""
self.openCounterDate(site=self.paris,id='counter_date_7',open=0)
self.openCounterDate(site=self.paris, id='counter_date_7', open=0)
self.counter_date_7.setStartDate(DateTime())
# open counter date and counter
self.assertRaises(ValidationFailed,
self.workflow_tool.doActionFor,
self.counter_date_7,'open_action',
self.counter_date_7, 'open_action',
wf_id='counter_date_workflow')
# get workflow history
workflow_history = self.workflow_tool.getInfoFor(
ob=self.counter_date_7, name='history', wf_id='counter_date_workflow')
# check its len is 2
msg = workflow_history[-1]['error_message']
self.assertTrue('there is already a counter date opened' in "%s" %(msg,))
self.assertTrue('there is already a counter date opened' in "%s" % (msg, ))
def stepCheckRemainingOperations(self,
sequence=None, sequence_list=None, **kwd):
......@@ -192,11 +192,11 @@ class TestERP5BankingAvailableInventory(TestERP5BankingCheckPaymentMixin,
line_list = self.line_list
start_date = DateTime()
self.resetInventory(source=None, destination=bi_counter_vault, currency=self.currency_1,
line_list=line_list,extra_id='_reset_in',
line_list=line_list, extra_id='_reset_in',
start_date=start_date)
bi_counter_vault = bi_counter.guichet_1.encaisse_des_billets_et_monnaies.sortante
self.resetInventory(source=None, destination=bi_counter_vault, currency=self.currency_1,
line_list=line_list,extra_id='_reset_out',
line_list=line_list, extra_id='_reset_out',
start_date=start_date)
def stepCheckRightStockBeforeClosingDate(self,
......
......@@ -65,8 +65,8 @@ class TestERP5BankingCashBalanceRegulation(TestERP5BankingMixin):
RUN_ALL_TEST = 1 # we want to run all test
QUIET = 0 # we don't want the test to be quiet
outgoing_quantity_5000 = {'variation/1992':4,'variation/2003':6}
outgoing_quantity_100 = {'variation/1992':24,'variation/2003':0}
outgoing_quantity_5000 = {'variation/1992':4, 'variation/2003':6}
outgoing_quantity_100 = {'variation/1992':24, 'variation/2003':0}
def getTitle(self):
"""
......@@ -302,7 +302,7 @@ class TestERP5BankingCashBalanceRegulation(TestERP5BankingMixin):
source='site/testsite/paris/caveau/auxiliaire/encaisse_des_externes')
#def stepCreateValidIncomingLine(self, sequence=None, sequence_list=None, **kwd):
def stepCreateValidIncomingLine(self, sequence=None, sequence_list=None, check_source=1,**kwd):
def stepCreateValidIncomingLine(self, sequence=None, sequence_list=None, check_source=1, **kwd):
"""
Create the cash balance regulation incoming line with banknotes of 10000 and check it has been well created
"""
......@@ -621,10 +621,10 @@ class TestERP5BankingCashBalanceRegulation(TestERP5BankingMixin):
"""
# do the workflow transition "deliver_action"
message = self.assertWorkflowTransitionFails(self.cash_balance_regulation,
'cash_balance_regulation_workflow','deliver_action')
'cash_balance_regulation_workflow', 'deliver_action')
self.assertTrue(message.find('local emission letter')>=0)
def stepCheckFinalInventory(self, sequence=None, sequence_list=None, check_source=1,**kwd):
def stepCheckFinalInventory(self, sequence=None, sequence_list=None, check_source=1, **kwd):
"""
Check inventory at source (vault encaisse_paris) after deliver of the cash sorting
"""
......@@ -642,7 +642,7 @@ class TestERP5BankingCashBalanceRegulation(TestERP5BankingMixin):
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.guichet_1.getRelativeUrl(), resource = self.piece_100.getRelativeUrl()), 0.0)
def stepCheckFinalInventoryCaveau(self, sequence=None, sequence_list=None, check_source=1,**kwd):
def stepCheckFinalInventoryCaveau(self, sequence=None, sequence_list=None, check_source=1, **kwd):
"""
Check inventory at source (vault encaisse_paris) after deliver of the cash sorting
"""
......@@ -660,7 +660,7 @@ class TestERP5BankingCashBalanceRegulation(TestERP5BankingMixin):
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.guichet_caveau.getRelativeUrl(), resource = self.piece_100.getRelativeUrl()), 0.0)
def stepCheckFinalInventorySalleTri(self, sequence=None, sequence_list=None, check_source=1,**kwd):
def stepCheckFinalInventorySalleTri(self, sequence=None, sequence_list=None, check_source=1, **kwd):
"""
Check inventory at source (vault encaisse_paris) after deliver of the cash sorting
"""
......@@ -678,7 +678,7 @@ class TestERP5BankingCashBalanceRegulation(TestERP5BankingMixin):
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.guichet_salletri.getRelativeUrl(), resource = self.piece_100.getRelativeUrl()), 0.0)
def stepCheckFinalInventorySurface(self, sequence=None, sequence_list=None, check_source=1,**kwd):
def stepCheckFinalInventorySurface(self, sequence=None, sequence_list=None, check_source=1, **kwd):
"""
Check inventory at source (vault encaisse_paris) after deliver of the cash sorting
"""
......@@ -695,7 +695,7 @@ class TestERP5BankingCashBalanceRegulation(TestERP5BankingMixin):
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.guichet_surface.getRelativeUrl(), resource = self.piece_100.getRelativeUrl()), 0.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.guichet_surface.getRelativeUrl(), resource = self.piece_100.getRelativeUrl()), 0.0)
def stepCheckFinalInventoryExternes(self, sequence=None, sequence_list=None, check_source=1,**kwd):
def stepCheckFinalInventoryExternes(self, sequence=None, sequence_list=None, check_source=1, **kwd):
"""
Check inventory at source (vault encaisse_paris) after deliver of the cash sorting
"""
......
......@@ -66,8 +66,8 @@ class TestERP5BankingCashExchange(TestERP5BankingMixin):
RUN_ALL_TEST = 1 # we want to run all test
QUIET = 0 # we don't want the test to be quiet
outgoing_quantity_5000 = {'variation/1992':4,'variation/2003':6}
outgoing_quantity_100 = {'variation/1992':24,'variation/2003':0}
outgoing_quantity_5000 = {'variation/1992':4, 'variation/2003':6}
outgoing_quantity_100 = {'variation/1992':24, 'variation/2003':0}
def getTitle(self):
"""
......
......@@ -114,7 +114,7 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin):
self.createManagerAndLogin()
# create categories
self.createFunctionGroupSiteCategory(site_list=['paris','madrid'])
self.createFunctionGroupSiteCategory(site_list=['paris', 'madrid'])
# Before the test, we need to input the inventory
......@@ -380,7 +380,7 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin):
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']
self.assertTrue('Insufficient balance' in "%s" %(msg,))
self.assertTrue('Insufficient balance' in "%s" %(msg, ))
def stepTryConfirmCashMovementWithBadInventory(self, sequence=None, sequence_list=None, **kwd):
......@@ -610,7 +610,7 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin):
node = self.vault_source
line_list = self.line_list
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')
......@@ -620,7 +620,7 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin):
Try if we get Insufficient balance
"""
message = self.assertWorkflowTransitionFails(self.cash_movement,
'cash_movement_workflow','start_action')
'cash_movement_workflow', 'start_action')
self.assertTrue(message.find('Insufficient balance')>=0)
......
......@@ -135,8 +135,8 @@ class TestERP5BankingCashMovementNewNotEmitted(TestERP5BankingMonetaryReceptionM
# get the cash container item from the monetary reception
cash_container_item_list = [x.getObject() for x in self.simulation_tool.getCurrentTrackingList(node=self.reception.getRelativeUrl())]
self.assertEqual(len(cash_container_item_list), 2)
def reference_sort(a,b):
return cmp(a.getReference(),b.getReference())
def reference_sort(a, b):
return cmp(a.getReference(), b.getReference())
cash_container_item_list.sort(reference_sort)
# contruct list of dict to create cash container
......@@ -144,7 +144,7 @@ class TestERP5BankingCashMovementNewNotEmitted(TestERP5BankingMonetaryReceptionM
i = 1
for cash_container in cash_container_item_list:
# register cash container on self to check aggregate value later
setattr(self, 'cash_container_item_%s' %(str(i),), cash_container)
setattr(self, 'cash_container_item_%s' %(str(i), ), cash_container)
container_dict = {}
container_dict['id'] = str(i)
container_dict['reference'] = cash_container.getReference()
......@@ -154,10 +154,10 @@ class TestERP5BankingCashMovementNewNotEmitted(TestERP5BankingMonetaryReceptionM
container_dict['quantity'] = cash_container_line.getQuantity()
container_dict['aggregate'] = cash_container
new_cash_container_list.append(container_dict)
i+=1
i += 1
def reference_sort(a,b):
return cmp(a['reference'],b['reference'])
def reference_sort(a, b):
return cmp(a['reference'], b['reference'])
new_cash_container_list.sort(reference_sort)
global_dict = {}
......
......@@ -66,8 +66,8 @@ class TestERP5BankingCashToCurrencyPurchase(TestERP5BankingMixin):
RUN_ALL_TEST = 1 # we want to run all test
QUIET = 0 # we don't want the test to be quiet
outgoing_quantity_5000 = {'variation/1992':4,'variation/2003':6}
outgoing_quantity_100 = {'variation/1992':120,'variation/2003':0}
outgoing_quantity_5000 = {'variation/1992':4, 'variation/2003':6}
outgoing_quantity_100 = {'variation/1992':120, 'variation/2003':0}
def getTitle(self):
"""
......@@ -119,7 +119,7 @@ class TestERP5BankingCashToCurrencyPurchase(TestERP5BankingMixin):
line_list_sortante = [inventory_dict_line_1, inventory_dict_line_2]
self.guichet_entrante = self.paris.surface.banque_interne.guichet_1.encaisse_des_devises.usd.sortante
self.guichet_sortante= self.paris.surface.banque_interne.guichet_1.encaisse_des_billets_et_monnaies.sortante
self.guichet_sortante = self.paris.surface.banque_interne.guichet_1.encaisse_des_billets_et_monnaies.sortante
self.guichet = self.paris.surface.banque_interne.guichet_1
......@@ -220,17 +220,17 @@ class TestERP5BankingCashToCurrencyPurchase(TestERP5BankingMixin):
self.setDocumentSourceReference(self.cash_to_currency_purchase)
# Check carrefully the script CurrencyPurchase_getQuantity
script = self.cash_to_currency_purchase.CurrencyPurchase_getQuantity
self.assertEqual(script(),65000)
self.assertEqual(script(), 65000)
self.cash_to_currency_purchase.setDiscountRatio(0.01)
self.assertEqual(script(),64350)
self.assertEqual(script(), 64350)
self.cash_to_currency_purchase.setDiscountRatio(None)
self.cash_to_currency_purchase.setDiscount(3000)
self.assertEqual(script(),62000)
self.assertEqual(script(), 62000)
# Check that we can define a specific rate
self.cash_to_currency_purchase.setCurrencyExchangeRate(660)
self.assertEqual(script(),63000)
self.assertEqual(script(), 63000)
self.cash_to_currency_purchase.setCurrencyExchangeRate(None)
self.assertEqual(script(),62000)
self.assertEqual(script(), 62000)
#def stepCreateValidIncomingLine(self, sequence=None, sequence_list=None, **kwd):
def stepCreateValidIncomingLine(self, sequence=None, sequence_list=None, **kwd):
......
......@@ -65,8 +65,8 @@ class TestERP5BankingCashToCurrencySale(TestERP5BankingMixin):
RUN_ALL_TEST = 1 # we want to run all test
QUIET = 0 # we don't want the test to be quiet
outgoing_quantity_5000 = {'variation/1992':4,'variation/2003':6}
outgoing_quantity_100 = {'variation/1992':200,'variation/2003':0}
outgoing_quantity_5000 = {'variation/1992':4, 'variation/2003':6}
outgoing_quantity_100 = {'variation/1992':200, 'variation/2003':0}
def getTitle(self):
"""
......@@ -109,7 +109,7 @@ class TestERP5BankingCashToCurrencySale(TestERP5BankingMixin):
self.line_list = line_list_sortante = [inventory_dict_line_1]
self.guichet_entrante = self.paris.surface.banque_interne.guichet_1.encaisse_des_billets_et_monnaies.entrante
self.guichet_sortante= self.paris.surface.banque_interne.guichet_1.encaisse_des_devises.usd.sortante
self.guichet_sortante = self.paris.surface.banque_interne.guichet_1.encaisse_des_devises.usd.sortante
self.guichet = self.paris.surface.banque_interne.guichet_1
......@@ -392,14 +392,14 @@ class TestERP5BankingCashToCurrencySale(TestERP5BankingMixin):
node = self.guichet_sortante
line_list = self.line_list
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 stepDeliverCashToCurrencySaleFails(self, sequence=None, sequence_list=None, **kwd):
"""
Try if we get Insufficient balance
"""
message = self.assertWorkflowTransitionFails(self.cash_to_currency_sale,
'cash_to_currency_sale_workflow','deliver_action')
'cash_to_currency_sale_workflow', 'deliver_action')
self.assertTrue(message.find('Insufficient balance')>=0)
##################################
......
......@@ -75,11 +75,11 @@ class TestERP5BankingCheckDeposit(TestERP5BankingMixin):
self.createManagerAndLogin()
# create categories
self.createFunctionGroupSiteCategory(site_list=['paris',])
self.createFunctionGroupSiteCategory(site_list=['paris'])
# define the user, a site is needed for accouting event
self.checkUserFolderType()
self.organisation = self.organisation_module.newContent(id='baobab_org', portal_type='Organisation',
function='banking', group='baobab', site='testsite/paris',role='internal')
function='banking', group='baobab', site='testsite/paris', role='internal')
user_dict = {
'super_user' : [['Manager'], self.organisation, 'banking/comptable', 'baobab', 'testsite/paris/surface/banque_interne/guichet_1']
}
......@@ -188,7 +188,7 @@ class TestERP5BankingCheckDeposit(TestERP5BankingMixin):
start_date = DateTime().Date(),
source_total_asset_price = 2000.0,
resource_value=self.currency_1,
external_software_value=None,)
external_software_value=None)
self.assertNotEqual(self.check_deposit, None)
self.assertEqual(self.check_deposit.getTotalPrice(fast=0), 0.0)
self.assertEqual(self.check_deposit.getDestinationPayment(), self.bank_account_1.getRelativeUrl())
......@@ -426,12 +426,12 @@ class TestERP5BankingCheckDeposit(TestERP5BankingMixin):
Remove previous check and create a new one with same reference,
like this we make sure the workflow history is empty
"""
self.checkbook_1.manage_delObjects([self.check_1.getId(),])
self.checkbook_1.manage_delObjects([self.check_1.getId(), ])
self.check_1 = self.createCheck(id='check_1',
reference='CHKNB1',
resource_value=self.check_model,
checkbook=self.checkbook_1)
self.checkbook_1.manage_delObjects([self.check_2.getId(),])
self.checkbook_1.manage_delObjects([self.check_2.getId()])
self.check_2 = self.createCheck(id='check_2',
reference='CHKNB2',
resource_value=self.check_model,
......@@ -443,7 +443,7 @@ class TestERP5BankingCheckDeposit(TestERP5BankingMixin):
Clear the check deposit module
"""
if hasattr(self, 'check_deposit'):
self.check_deposit_module.manage_delObjects([self.check_deposit.getId(),])
self.check_deposit_module.manage_delObjects([self.check_deposit.getId()])
def test_01_ERP5BankingCheckDeposit(self, quiet=QUIET, run=RUN_ALL_TEST):
"""
......
......@@ -247,7 +247,7 @@ class TestERP5BankingCheckPaymentMixin(TestERP5BankingMixin):
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="0000051")
self.createAnotherCheckPayment(sequence=sequence, will_fail=0, number="0000051")
def stepPayAnotherCheckPaymentFails(self, sequence=None, sequence_list=None, **kwd):
""" Make sure we can validate another check payment """
......@@ -282,8 +282,8 @@ class TestERP5BankingCheckPaymentMixin(TestERP5BankingMixin):
new_payment._setSource(self.bi_counter.getRelativeUrl())
if will_fail and insuffisient_balance:
message = self.assertWorkflowTransitionFails(new_payment,
'check_payment_workflow','plan_action')
LOG('self.assertWorkflowTransitionFails message',0,message)
'check_payment_workflow', 'plan_action')
LOG('self.assertWorkflowTransitionFails message', 0, message)
if insuffisient_balance:
self.assertTrue(message.find('Bank account is not sufficient')>=0)
# We will force it in order to test the next step
......@@ -295,8 +295,8 @@ class TestERP5BankingCheckPaymentMixin(TestERP5BankingMixin):
get_transaction().commit()
if will_fail:
message = self.assertWorkflowTransitionFails(new_payment,
'check_payment_workflow','confirm_action')
LOG('self.assertWorkflowTransitionFails message',0,message)
'check_payment_workflow', 'confirm_action')
LOG('self.assertWorkflowTransitionFails message', 0, message)
if pending_account:
self.assertTrue(message.find('There are operations pending for this account')>=0)
if insuffisient_balance:
......@@ -317,8 +317,8 @@ class TestERP5BankingCheckPaymentMixin(TestERP5BankingMixin):
if check_pay_will_fail:
self.stepInputCashDetails(check_payment=new_payment)
message = self.assertWorkflowTransitionFails(new_payment,
'check_payment_workflow','deliver_action')
LOG('self.assertWorkflowTransitionFails message',0,message)
'check_payment_workflow', 'deliver_action')
LOG('self.assertWorkflowTransitionFails message', 0, message)
self.assertTrue(message.find('There are operations pending for this vault')>=0)
self.workflow_tool.doActionFor(new_payment, 'reject_action',
wf_id='check_payment_workflow')
......@@ -480,7 +480,7 @@ class TestERP5BankingCheckPaymentMixin(TestERP5BankingMixin):
bi_counter_vault = self.bi_counter_vault
line_list = self.line_list
self.resetInventory(source=None, destination=bi_counter_vault, currency=self.currency_1,
line_list=line_list,extra_id='_reset_out')
line_list=line_list, extra_id='_reset_out')
def stepPayCheckPaymentFails(self, sequence=None, sequence_list=None, **kwd):
"""
......@@ -489,7 +489,7 @@ class TestERP5BankingCheckPaymentMixin(TestERP5BankingMixin):
FIXME: check if the transition fails when a category or property is invalid.
"""
message = self.assertWorkflowTransitionFails(self.check_payment,
'check_payment_workflow','deliver_action')
'check_payment_workflow', 'deliver_action')
self.assertTrue(message.find('Insufficient balance')>=0)
def stepCheckCheckIsDelivered(self, sequence=None, sequence_list=None, **kwd):
......
......@@ -178,7 +178,7 @@ class TestERP5BankingCheckbookDelivery(TestERP5BankingCheckbookDeliveryMixin,
self.assertEqual(len(checkbook_list), 2)
# check we have cash checkbook 1
checkbook_object_list = [x.getObject() for x in checkbook_list]
self.failIfDifferentSet(checkbook_object_list,[self.check_1,self.checkbook_1])
self.failIfDifferentSet(checkbook_object_list, [self.check_1, self.checkbook_1])
def stepCreateCheckbookDelivery(self, sequence=None, sequence_list=None, **kwd):
"""
......@@ -234,7 +234,7 @@ class TestERP5BankingCheckbookDelivery(TestERP5BankingCheckbookDeliveryMixin,
self.assertEqual(state, 'delivered')
# check that checks are issued
check = self.checkbook_1.objectValues()[0]
self.assertEqual(check.getSimulationState(),'confirmed')
self.assertEqual(check.getSimulationState(), 'confirmed')
def stepCheckFinalCheckbookInventory(self, sequence=None, sequence_list=None, **kw):
......@@ -253,7 +253,7 @@ class TestERP5BankingCheckbookDelivery(TestERP5BankingCheckbookDeliveryMixin,
self.assertEqual(len(checkbook_list), 1)
# check we have cash checkbook 1
checkbook_object_list = [x.getObject() for x in checkbook_list]
self.failIfDifferentSet(checkbook_object_list,[self.check_1])
self.failIfDifferentSet(checkbook_object_list, [self.check_1])
def stepChangePreviousDeliveryDate(self,
sequence=None, sequence_list=None, **kwd):
......@@ -269,7 +269,7 @@ class TestERP5BankingCheckbookDelivery(TestERP5BankingCheckbookDeliveryMixin,
Try if we get Insufficient balance
"""
message = self.assertWorkflowTransitionFails(self.checkbook_delivery,
'checkbook_delivery_workflow','deliver_action')
'checkbook_delivery_workflow', 'deliver_action')
self.assertTrue(message.find('Sorry, the item with reference')>=0)
self.assertTrue(message.find('is not available any more')>=0)
......
......@@ -75,7 +75,7 @@ class TestERP5BankingCheckbookMovement(TestERP5BankingCheckbookVaultTransferMixi
self.checkbook_model_module = self.getCheckbookModelModule()
self.createManagerAndLogin()
self.createFunctionGroupSiteCategory(site_list=['paris','madrid'])
self.createFunctionGroupSiteCategory(site_list=['paris', 'madrid'])
self.createCheckAndCheckbookModel()
self.reception_destination_site = self.paris
self.source_site = self.paris
......@@ -281,7 +281,7 @@ class TestERP5BankingCheckbookMovement(TestERP5BankingCheckbookVaultTransferMixi
self.assertEqual(len(checkbook_list), 2)
# check we have cash checkbook 1
checkbook_object_list = [x.getObject() for x in checkbook_list]
self.failIfDifferentSet(checkbook_object_list,[self.checkbook_1,self.check_1])
self.failIfDifferentSet(checkbook_object_list, [self.checkbook_1, self.check_1])
self.assertEqual(len(self.simulation_tool.getFutureTrackingList(
node=self.destination_vault.getRelativeUrl())), 2)
......@@ -299,7 +299,7 @@ class TestERP5BankingCheckbookMovement(TestERP5BankingCheckbookVaultTransferMixi
Try if we get Insufficient balance
"""
message = self.assertWorkflowTransitionFails(self.checkbook_movement,
'checkbook_movement_workflow','confirm_to_deliver_action')
'checkbook_movement_workflow', 'confirm_to_deliver_action')
self.assertTrue(message.find('Sorry, the item with reference')>=0)
self.assertTrue(message.find('is not available any more')>=0)
......
......@@ -281,18 +281,18 @@ class TestERP5BankingCheckbookReception(TestERP5BankingMixin):
for line in self.checkbook_reception.objectValues():
aggregate_value_list = line.getAggregateValueList()
self.assertEquals(len(aggregate_value_list),1)
self.assertEquals(len(aggregate_value_list), 1)
aggregate_value = aggregate_value_list[0]
if aggregate_value.getPortalType()=='Checkbook':
self.checkbook_1 = aggregate_value
elif aggregate_value.getPortalType()=='Check':
self.check_1 = aggregate_value
# Make sure new check is in draft mode
self.assertEquals(self.check_1.getSimulationState(),'draft')
self.assertNotEquals(None,self.checkbook_1)
self.assertNotEquals(None,self.check_1)
self.assertEquals(self.check_1.getSimulationState(), 'draft')
self.assertNotEquals(None, self.checkbook_1)
self.assertNotEquals(None, self.check_1)
# Make sure that all checks inside checkbook are create
self.assertEquals(len(self.checkbook_1.objectValues()),50)
self.assertEquals(len(self.checkbook_1.objectValues()), 50)
# Make sure that all checks inside checkbook are not issued yet
self.assertEquals(self.checkbook_1.objectValues()[0].getSimulationState(),
'draft')
......@@ -422,7 +422,7 @@ class TestERP5BankingCheckbookReception(TestERP5BankingMixin):
self.assertEqual(len(checkbook_list), 2)
# check we have cash checkbook 1
checkbook_object_list = [x.getObject() for x in checkbook_list]
self.failIfDifferentSet(checkbook_object_list,[self.checkbook_1,self.check_1])
self.failIfDifferentSet(checkbook_object_list, [self.checkbook_1, self.check_1])
self.assertEqual(len(self.simulation_tool.getFutureTrackingList(node=self.reception.getRelativeUrl())), 2)
def stepCheckConfirmedCheckbookForImport(self, sequence=None, sequence_list=None, **kw):
......
......@@ -319,9 +319,9 @@ class TestERP5BankingCheckbookUsualCashTransfer(TestERP5BankingCheckbookUsualCas
"""
Check cash checkbook in item table
"""
LOG('sql request for getCurrentTrackingList',0,self.simulation_tool.getCurrentTrackingList(
LOG('sql request for getCurrentTrackingList', 0, self.simulation_tool.getCurrentTrackingList(
node=self.source_vault.getRelativeUrl(),
at_date=self.date,src__=1))
at_date=self.date, src__=1))
self.assertEqual(len(self.simulation_tool.getCurrentTrackingList(
node=self.source_vault.getRelativeUrl(),
at_date=self.date)), 0)
......@@ -340,7 +340,7 @@ class TestERP5BankingCheckbookUsualCashTransfer(TestERP5BankingCheckbookUsualCas
self.assertEqual(len(checkbook_list), 2)
# check we have cash checkbook 1
checkbook_object_list = [x.getObject() for x in checkbook_list]
self.failIfDifferentSet(checkbook_object_list,[self.checkbook_1,self.check_1])
self.failIfDifferentSet(checkbook_object_list, [self.checkbook_1, self.check_1])
self.assertEqual(len(self.simulation_tool.getFutureTrackingList(
node=self.destination_vault.getRelativeUrl(),
at_date=self.date)), 2)
......@@ -359,7 +359,7 @@ class TestERP5BankingCheckbookUsualCashTransfer(TestERP5BankingCheckbookUsualCas
Try if we get Insufficient balance
"""
message = self.assertWorkflowTransitionFails(self.checkbook_usual_cash_transfer,
'checkbook_usual_cash_transfer_workflow','confirm_to_deliver_action')
'checkbook_usual_cash_transfer_workflow', 'confirm_to_deliver_action')
self.assertTrue(message.find('Sorry, the item with reference')>=0)
self.assertTrue(message.find('is not available any more')>=0)
......
......@@ -105,10 +105,10 @@ class TestERP5BankingCheckbookVaultTransferMixin(TestERP5BankingMixin):
sequence_list=None, **kwd):
self.checkItemsCreated(sequence=sequence,
sequence_list=sequence_list,
traveler_check=1,**kwd)
traveler_check=1, **kwd)
def checkItemsCreated(self, sequence=None, sequence_list=None,
traveler_check=0,**kwd):
traveler_check=0, **kwd):
"""
Create the checkbook
"""
......@@ -118,7 +118,7 @@ class TestERP5BankingCheckbookVaultTransferMixin(TestERP5BankingMixin):
for line in self.checkbook_reception.objectValues():
aggregate_value_list = line.getAggregateValueList()
self.assertEquals(len(aggregate_value_list),1)
self.assertEquals(len(aggregate_value_list), 1)
aggregate_value = aggregate_value_list[0]
if aggregate_value.getPortalType()=='Checkbook':
self.checkbook_1 = aggregate_value
......@@ -128,10 +128,10 @@ class TestERP5BankingCheckbookVaultTransferMixin(TestERP5BankingMixin):
else:
self.check_1 = aggregate_value
if not traveler_check:
self.assertNotEquals(None,self.checkbook_1)
self.assertNotEquals(None,self.check_1)
self.assertNotEquals(None, self.checkbook_1)
self.assertNotEquals(None, self.check_1)
else:
self.assertNotEquals(traveler_check,None)
self.assertNotEquals(traveler_check, None)
def stepPutBackPreviousDeliveryDate(self,
sequence=None, sequence_list=None, **kwd):
......@@ -339,7 +339,7 @@ class TestERP5BankingCheckbookVaultTransfer(TestERP5BankingCheckbookVaultTransfe
self.assertEqual(len(checkbook_list), 2)
# check we have cash checkbook 1
checkbook_object_list = [x.getObject() for x in checkbook_list]
self.failIfDifferentSet(checkbook_object_list,[self.checkbook_1,self.check_1])
self.failIfDifferentSet(checkbook_object_list, [self.checkbook_1, self.check_1])
self.assertEqual(len(self.simulation_tool.getFutureTrackingList(
node=self.destination_vault.getRelativeUrl())), 2)
......@@ -357,7 +357,7 @@ class TestERP5BankingCheckbookVaultTransfer(TestERP5BankingCheckbookVaultTransfe
Try if we get Insufficient balance
"""
message = self.assertWorkflowTransitionFails(self.checkbook_vault_transfer,
'checkbook_vault_transfer_workflow','deliver_action')
'checkbook_vault_transfer_workflow', 'deliver_action')
self.assertTrue(message.find('Sorry, the item with reference')>=0)
self.assertTrue(message.find('is not available any more')>=0)
......
......@@ -112,7 +112,7 @@ class TestERP5BankingCounterDate(TestERP5BankingMixin):
if not quiet:
message = 'Check open CounterDate twice fails'
ZopeTestCase._print('\n%s ' % message)
LOG('Testing... ',0,message)
LOG('Testing... ', 0, message)
self.openCounterDate(site=self.paris, id='counter_date_1')
get_transaction().commit()
self.tic()
......@@ -127,7 +127,7 @@ class TestERP5BankingCounterDate(TestERP5BankingMixin):
ob=self.counter_date_2, name='history', wf_id='counter_date_workflow')
# check its len is 2
msg = workflow_history[-1]['error_message']
self.assertTrue('there is already a counter date opened' in "%s" %(msg,))
self.assertTrue('there is already a counter date opened' in "%s" %(msg, ))
def test_02_CheckOpenCounterDateWithOtherDateFail(self, quiet=QUIET, run=RUN_ALL_TEST):
"""
......@@ -137,21 +137,21 @@ class TestERP5BankingCounterDate(TestERP5BankingMixin):
if not quiet:
message = 'Check open CounterDate on non-current date fails'
ZopeTestCase._print('\n%s ' % message)
LOG('Testing... ',0,message)
LOG('Testing... ', 0, message)
def openAndTest(id, date):
self.openCounterDate(site=self.paris, id=id, date=date, open=0)
# open counter date and counter
counter_date = getattr(self, id)
self.assertRaises(ValidationFailed,
self.workflow_tool.doActionFor,
counter_date,'open_action',
counter_date, 'open_action',
wf_id='counter_date_workflow')
# get workflow history
workflow_history = self.workflow_tool.getInfoFor(
ob=counter_date, name='history', wf_id='counter_date_workflow')
# check its len is 2
msg = workflow_history[-1]['error_message']
self.assertTrue('the date is not today' in "%s" %(msg,))
self.assertTrue('the date is not today' in "%s" %(msg, ))
now = DateTime()
# Future
openAndTest('1', now + 2) # Just in case midnight passes between "now" calculation and validation, add 2 instead of 1
......@@ -172,7 +172,7 @@ class TestERP5BankingCounterDate(TestERP5BankingMixin):
if not quiet:
message = 'Check CounterDate reference generator behaviour'
ZopeTestCase._print('\n%s ' % message)
LOG('Testing... ',0,message)
LOG('Testing... ', 0, message)
counter_date_module = self.getPortal().counter_date_module
def openAndTest(site, date, reference):
id = 'counter_date_%s_%s' % (str(date).replace('/', '_'), site.getId())
......@@ -213,7 +213,7 @@ class TestERP5BankingCounterDate(TestERP5BankingMixin):
if not quiet:
message = 'Check open CounterDate twice without activities fails'
ZopeTestCase._print('\n%s ' % message)
LOG('Testing... ',0,message)
LOG('Testing... ', 0, message)
self.openCounterDate(site=self.paris, id='counter_date_1')
get_transaction().commit()
self.openCounterDate(site=self.paris, id='counter_date_2', open=0)
......
......@@ -193,9 +193,9 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin):
self.login('super_user')
# open counter date and counter
self.openCounterDate(site=self.paris)
self.openCounterDate(site=self.madrid,id='counter_date_2')
self.openCounterDate(site=self.madrid, id='counter_date_2')
lyon = portal.portal_categories.site.testsite.auxiliaire.lyon
self.openCounterDate(site=lyon,id='counter_date_3')
self.openCounterDate(site=lyon, id='counter_date_3')
def stepCheckObjects(self, sequence=None, sequence_list=None, **kwd):
"""
......
......@@ -148,7 +148,7 @@ class TestERP5BankingMonetaryIssue(TestERP5BankingMonetaryReceptionMixin):
self.monetary_reception_module = self.getMonetaryReceptionModule()
self.current_date = DateTime()
self.createManagerAndLogin()
self.createFunctionGroupSiteCategory(site_list=['paris',])
self.createFunctionGroupSiteCategory(site_list=['paris'])
self.issue = self.paris.caveau.reserve.encaisse_des_billets_et_monnaies
self.reception = self.paris.caveau.serre.encaisse_des_billets_neufs_non_emis
self.reception_site = self.reception
......@@ -222,7 +222,7 @@ class TestERP5BankingMonetaryIssue(TestERP5BankingMonetaryReceptionMixin):
# get the cash container item from the monetary reception
cash_container_item_list = [x.getObject() for x in self.simulation_tool.getCurrentTrackingList(node=self.reception.getRelativeUrl())]
self.assertEqual(len(cash_container_item_list), 2)
def reference_sort(a,b): return cmp(a.getReference(),b.getReference())
def reference_sort(a, b): return cmp(a.getReference(), b.getReference())
cash_container_item_list.sort(reference_sort)
# contruct list of dict to create cash container
......@@ -230,7 +230,7 @@ class TestERP5BankingMonetaryIssue(TestERP5BankingMonetaryReceptionMixin):
i = 1
for cash_container in cash_container_item_list:
# register cash container on self to check aggregate value later
setattr(self, 'cash_container_item_%s' %(str(i),), cash_container)
setattr(self, 'cash_container_item_%s' %(str(i), ), cash_container)
container_dict = {}
container_dict['id'] = str(i)
container_dict['reference'] = cash_container.getReference()
......@@ -240,9 +240,9 @@ class TestERP5BankingMonetaryIssue(TestERP5BankingMonetaryReceptionMixin):
container_dict['quantity'] = cash_container_line.getQuantity()
container_dict['aggregate'] = cash_container
new_cash_container_list.append(container_dict)
i+=1
def reference_sort(a,b):
return cmp(a['reference'],b['reference'])
i += 1
def reference_sort(a, b):
return cmp(a['reference'], b['reference'])
new_cash_container_list.sort(reference_sort)
......
......@@ -78,7 +78,7 @@ class TestERP5BankingMonetaryReception(TestERP5BankingMixin):
self.monetary_reception_module = self.getMonetaryReceptionModule()
self.createManagerAndLogin()
self.createFunctionGroupSiteCategory(site_list=['paris',])
self.createFunctionGroupSiteCategory(site_list=['paris'])
self.reception = self.paris.caveau.serre.encaisse_des_billets_neufs_non_emis
self.checkUserFolderType()
self.organisation = self.organisation_module.newContent(id='baobab_org', portal_type='Organisation',
......
......@@ -75,7 +75,7 @@ class TestERP5BankingMoneyDepositMixin(TestERP5BankingMixin):
# Create a user and login as manager to populate the erp5 portal with objects for tests.
self.createManagerAndLogin()
self.createFunctionGroupSiteCategory(site_list=['paris',])
self.createFunctionGroupSiteCategory(site_list=['paris'])
"""
Windows to create the BANKNOTES of 10 000 and 5000, coins 200.
......@@ -297,8 +297,8 @@ class TestERP5BankingMoneyDepositMixin(TestERP5BankingMixin):
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.money_deposit_counter_vault.getRelativeUrl(), resource = self.billet_5000.getRelativeUrl()), 26.0)
# check the final inventory of the bank account
#self.assertEqual(self.simulation_tool.getCurrentInventory(payment=self.bank_account_1.getRelativeUrl()), 120000)
self.assertEqual(self.simulation_tool.getCurrentInventory(payment=self.bank_account_1.getRelativeUrl(),resource=self.currency_1.getRelativeUrl()), 120000)
self.assertEqual(self.simulation_tool.getFutureInventory(payment=self.bank_account_1.getRelativeUrl(),resource=self.currency_1.getRelativeUrl()), 120000)
self.assertEqual(self.simulation_tool.getCurrentInventory(payment=self.bank_account_1.getRelativeUrl(), resource=self.currency_1.getRelativeUrl()), 120000)
self.assertEqual(self.simulation_tool.getFutureInventory(payment=self.bank_account_1.getRelativeUrl(), resource=self.currency_1.getRelativeUrl()), 120000)
def stepDelMoneyDeposit(self, sequence=None, sequence_list=None, **kwd):
"""
......
......@@ -78,7 +78,7 @@ class TestERP5BankingMutilatedBanknote(TestERP5BankingMixin):
'variation_value': ('emission_letter/not_defined', 'cash_status/valid') + self.variation_list,
'quantity': self.quantity_10000}
line_list = [inventory_dict_line_1,]
line_list = [inventory_dict_line_1]
self.mutilated_banknote_vault = self.paris.surface.caisse_courante.billets_mutiles
self.maculated_banknote_vault = self.paris.surface.caisse_courante.billets_macules
self.counter = self.paris.surface.banque_interne.guichet_1.encaisse_des_billets_et_monnaies.sortante
......
......@@ -105,8 +105,8 @@ class TestERP5BankingStopPayment( TestERP5BankingCheckbookDeliveryMixin,
For this test, the intial inventory and the final inventory is the same
"""
# check the inventory of the bank account
self.assertEqual(self.simulation_tool.getCurrentInventory(payment=self.bank_account_2.getRelativeUrl(),resource=self.currency_1.getRelativeUrl()), 100000)
self.assertEqual(self.simulation_tool.getFutureInventory(payment=self.bank_account_2.getRelativeUrl(),resource=self.currency_1.getRelativeUrl()), 100000)
self.assertEqual(self.simulation_tool.getCurrentInventory(payment=self.bank_account_2.getRelativeUrl(), resource=self.currency_1.getRelativeUrl()), 100000)
self.assertEqual(self.simulation_tool.getFutureInventory(payment=self.bank_account_2.getRelativeUrl(), resource=self.currency_1.getRelativeUrl()), 100000)
def stepCreateStopPayment(self, sequence=None, sequence_list=None, **kwd):
"""
......@@ -142,10 +142,10 @@ class TestERP5BankingStopPayment( TestERP5BankingCheckbookDeliveryMixin,
"""
line_list = self.stop_payment.objectValues(
portal_type='Checkbook Delivery Line')
self.assertEqual(len(line_list),1)
self.assertEqual(len(line_list), 1)
line = line_list[0]
self.assertEqual(line.getAggregateValue(),self.check_1)
self.assertEqual(line.getQuantity(),1)
self.assertEqual(line.getAggregateValue(), self.check_1)
self.assertEqual(line.getQuantity(), 1)
def stepSetStopPaymentDebit(self, sequence=None, sequence_list=None, **kwd):
"""
......@@ -157,7 +157,7 @@ class TestERP5BankingStopPayment( TestERP5BankingCheckbookDeliveryMixin,
"""
Set the debit required
"""
self.stop_payment_module.manage_delObjects(['stop_payment',])
self.stop_payment_module.manage_delObjects(['stop_payment'])
def stepConfirmStopPayment(self, sequence=None, sequence_list=None, **kw):
"""
......@@ -280,26 +280,26 @@ class TestERP5BankingStopPayment( TestERP5BankingCheckbookDeliveryMixin,
"""
# check the inventory of the bank account
self.assertEqual(self.simulation_tool.getCurrentInventory(
payment=self.bank_account_2.getRelativeUrl()
,resource=self.currency_1.getRelativeUrl()), 100000)
payment=self.bank_account_2.getRelativeUrl(),
resource=self.currency_1.getRelativeUrl()), 100000)
self.assertEqual(self.simulation_tool.getAvailableInventory(
payment=self.bank_account_2.getRelativeUrl()
,resource=self.currency_1.getRelativeUrl()), 80000)
payment=self.bank_account_2.getRelativeUrl(),
resource=self.currency_1.getRelativeUrl()), 80000)
self.assertEqual(self.simulation_tool.getFutureInventory(
payment=self.bank_account_2.getRelativeUrl()
,resource=self.currency_1.getRelativeUrl()), 80000)
payment=self.bank_account_2.getRelativeUrl(),
resource=self.currency_1.getRelativeUrl()), 80000)
def stepCheckCheckIsStopped(self, sequence=None, sequence_list=None, **kw):
"""
Check that the check is stopped
"""
self.assertEqual(self.check_1.getSimulationState(),'stopped')
self.assertEqual(self.check_1.getSimulationState(), 'stopped')
def stepCheckCheckIsConfirmed(self, sequence=None, sequence_list=None, **kw):
"""
Check that the check is confirmed
"""
self.assertEqual(self.check_1.getSimulationState(),'confirmed')
self.assertEqual(self.check_1.getSimulationState(), 'confirmed')
##################################
## Tests
......
......@@ -113,7 +113,7 @@ class TestERP5BankingTravelerCheckPurchase(TestERP5BankingCheckbookUsualCashTran
self.assertEqual(len(checkbook_list), 0)
# check we have cash checkbook 1
checkbook_object_list = [x.getObject() for x in checkbook_list]
self.failIfDifferentSet(checkbook_object_list,[])
self.failIfDifferentSet(checkbook_object_list, [])
# check the inventory of the bank account
self.assertEqual(self.simulation_tool.getCurrentInventory(
payment=self.bank_account_1.getRelativeUrl(),
......@@ -199,7 +199,7 @@ class TestERP5BankingTravelerCheckPurchase(TestERP5BankingCheckbookUsualCashTran
self.assertEqual(len(checkbook_list), 0)
# check we have cash checkbook 1
checkbook_object_list = [x.getObject() for x in checkbook_list]
self.assertEquals(len(checkbook_object_list),0)
self.assertEquals(len(checkbook_object_list), 0)
# check the inventory of the bank account
self.assertEqual(self.simulation_tool.getCurrentInventory(
payment=self.bank_account_1.getRelativeUrl(),
......
......@@ -251,7 +251,7 @@ class TestERP5BankingTravelerCheckSale(TestERP5BankingCheckbookUsualCashTransfer
self.assertEqual(len(checkbook_list), 1)
# check we have cash checkbook 1
checkbook_object_list = [x.getObject() for x in checkbook_list]
self.failIfDifferentSet(checkbook_object_list,[self.traveler_check])
self.failIfDifferentSet(checkbook_object_list, [self.traveler_check])
# check the inventory of the bank account
self.assertEqual(self.simulation_tool.getCurrentInventory(
payment=self.bank_account_1.getRelativeUrl(),
......@@ -278,7 +278,7 @@ class TestERP5BankingTravelerCheckSale(TestERP5BankingCheckbookUsualCashTransfer
self.assertEqual(len(checkbook_list), 0)
# check we have cash checkbook 1
checkbook_object_list = [x.getObject() for x in checkbook_list]
self.assertEquals(len(checkbook_object_list),0)
self.assertEquals(len(checkbook_object_list), 0)
# check the inventory of the bank account
self.assertEqual(self.simulation_tool.getCurrentInventory(
payment=self.bank_account_1.getRelativeUrl(),
......
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