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
......@@ -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