Commit 35ae22df authored by Kevin Deldycke's avatar Kevin Deldycke

* Split the fist step in two to add a TIC between.

* Clarrify some comments.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4561 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent fc085f12
...@@ -112,7 +112,8 @@ class TestERP5BankingCashTransfer(ERP5TypeTestCase): ...@@ -112,7 +112,8 @@ class TestERP5BankingCashTransfer(ERP5TypeTestCase):
Return the list of business templates we need Return the list of business templates we need
""" """
return ( 'erp5_trade' # erp5_trade is not required to make erp5_banking_cash_transfer working. return ( 'erp5_trade' # erp5_trade is not required to make erp5_banking_cash_transfer working.
# As explained below erp5_trade is just used to help us initialize ressources. # As explained below erp5_trade is just used to help us initialize ressources
# via Internal Packing List.
, 'erp5_banking_core' , 'erp5_banking_core'
, 'erp5_banking_cash_transfer' , 'erp5_banking_cash_transfer'
) )
...@@ -201,7 +202,7 @@ class TestERP5BankingCashTransfer(ERP5TypeTestCase): ...@@ -201,7 +202,7 @@ class TestERP5BankingCashTransfer(ERP5TypeTestCase):
# Create some users who will get different roles on the cash transfer. # Create some users who will get different roles on the cash transfer.
# #
# Dictionnary data scheme: # Dictionnary data scheme:
# 'user_login': ['user_type', ['Global Role'], 'organisation', 'function', 'group', 'site'] # 'user_login': [['Global Role'], 'organisation', 'function', 'group', 'site']
# #
user_dict = { user_dict = {
'user_1' : [[], self.organisation, 'banking/caissier_principal', 'baobab', 'testsite'] 'user_1' : [[], self.organisation, 'banking/caissier_principal', 'baobab', 'testsite']
...@@ -211,11 +212,10 @@ class TestERP5BankingCashTransfer(ERP5TypeTestCase): ...@@ -211,11 +212,10 @@ class TestERP5BankingCashTransfer(ERP5TypeTestCase):
self.createERP5Users(user_dict) self.createERP5Users(user_dict)
# We must assign local roles to cash_transfer_module manually, as they are # We must assign local roles to cash_transfer_module manually, as they are
# not packed in Business Templates yet # not packed in Business Templates yet.
if self.PAS_installed: if self.PAS_installed:
pass pass
# TODO: Do something with PAS ! # TODO: create local roles manually with PAS (don't know how to do yet).
# By I don't know yet how to create local roles manually with PAS.
else: else:
self.cash_transfer_module.manage_addLocalGroupRoles('CCP_BAOBAB_TEST', ('Author',)) self.cash_transfer_module.manage_addLocalGroupRoles('CCP_BAOBAB_TEST', ('Author',))
...@@ -229,8 +229,8 @@ class TestERP5BankingCashTransfer(ERP5TypeTestCase): ...@@ -229,8 +229,8 @@ class TestERP5BankingCashTransfer(ERP5TypeTestCase):
self.billet_5000 = self.currency_cash_module.newContent(id='billet_5000', portal_type='Banknote', base_price=5000, price_currency_value=self.currency_1, variation_list=('1992', '2003'), quantity_unit_value=self.unit) self.billet_5000 = self.currency_cash_module.newContent(id='billet_5000', portal_type='Banknote', base_price=5000, price_currency_value=self.currency_1, variation_list=('1992', '2003'), quantity_unit_value=self.unit)
self.piece_200 = self.currency_cash_module.newContent(id='piece_200', portal_type='Coin', base_price=200, price_currency_value=self.currency_1, variation_list=('1992', '2003'), quantity_unit_value=self.unit) self.piece_200 = self.currency_cash_module.newContent(id='piece_200', portal_type='Coin', base_price=200, price_currency_value=self.currency_1, variation_list=('1992', '2003'), quantity_unit_value=self.unit)
# Before the test, we need to create resources in the source # Before the test, we need to create resources in the source.
# Using internal_packing_list from erp5_trade is the easiest # Using internal_packing_list from erp5_trade is the easiest.
self.portal.portal_delivery_type_list = list(self.portal.portal_delivery_type_list) self.portal.portal_delivery_type_list = list(self.portal.portal_delivery_type_list)
self.portal.portal_delivery_type_list.append('Internal Packing List') self.portal.portal_delivery_type_list.append('Internal Packing List')
self.portal.portal_delivery_type_list = tuple(self.portal.portal_delivery_type_list) self.portal.portal_delivery_type_list = tuple(self.portal.portal_delivery_type_list)
...@@ -238,6 +238,8 @@ class TestERP5BankingCashTransfer(ERP5TypeTestCase): ...@@ -238,6 +238,8 @@ class TestERP5BankingCashTransfer(ERP5TypeTestCase):
self.portal.portal_delivery_movement_type_list.append('Internal Packing List Line') self.portal.portal_delivery_movement_type_list.append('Internal Packing List Line')
self.portal.portal_delivery_movement_type_list = tuple(self.portal.portal_delivery_movement_type_list) self.portal.portal_delivery_movement_type_list = tuple(self.portal.portal_delivery_movement_type_list)
LOG("KevAcquisition",0,repr(self.portal.getPortalAcquisitionMovementTypeList()))
self.internal_packing_list_module = self.getInternalPackingListModule() self.internal_packing_list_module = self.getInternalPackingListModule()
self.internal_packing_list = self.internal_packing_list_module.newContent(id='packing_list_1', portal_type='Internal Packing List', self.internal_packing_list = self.internal_packing_list_module.newContent(id='packing_list_1', portal_type='Internal Packing List',
source=None, destination_value=self.caisse_1) source=None, destination_value=self.caisse_1)
...@@ -281,7 +283,7 @@ class TestERP5BankingCashTransfer(ERP5TypeTestCase): ...@@ -281,7 +283,7 @@ class TestERP5BankingCashTransfer(ERP5TypeTestCase):
manager_roles = ['Manager'] manager_roles = ['Manager']
if self.PAS_installed: if self.PAS_installed:
# As said in PluggableAuthService/interfaces/authservice.py, userFolderAddUser() # As said in PluggableAuthService/interfaces/authservice.py, userFolderAddUser()
# method is "not supported out-of-the-box by the pluggable authentication service". # method is "not supported out-of-the-box by the pluggable authentication service".
# That's why in the case of PAS we have to create and assign roles manually. # That's why in the case of PAS we have to create and assign roles manually.
self.user_folder.zodb_users.manage_addUser( user_id = manager_login self.user_folder.zodb_users.manage_addUser( user_id = manager_login
, login_name = manager_login , login_name = manager_login
...@@ -320,15 +322,15 @@ class TestERP5BankingCashTransfer(ERP5TypeTestCase): ...@@ -320,15 +322,15 @@ class TestERP5BankingCashTransfer(ERP5TypeTestCase):
self.assignPASRolesToUser(user_login, user_roles) self.assignPASRolesToUser(user_login, user_roles)
elif not self.PAS_installed: elif not self.PAS_installed:
# The user_folder counterpart of the erp5 user must be # The user_folder counterpart of the erp5 user must be
# created manually in the case of NuxUserGroup. # created manually in the case of NuxUserGroup.
self.user_folder.userFolderAddUser( name = user_login self.user_folder.userFolderAddUser( name = user_login
, password = '' , password = ''
, roles = user_roles , roles = user_roles
, domains = [] , domains = []
) )
# User assignment to security groups is also required, but is taken care of # User assignment to security groups is also required, but is taken care of
# by the assignment workflow when NuxUserGroup is used and # by the assignment workflow when NuxUserGroup is used and
# by ERP5Security PAS plugins in the context of PAS use. # by ERP5Security PAS plugins in the context of PAS use.
assignment.open() assignment.open()
...@@ -339,29 +341,41 @@ class TestERP5BankingCashTransfer(ERP5TypeTestCase): ...@@ -339,29 +341,41 @@ class TestERP5BankingCashTransfer(ERP5TypeTestCase):
def addCashLineToDelivery(self, delivery_object, line_id, line_portal_type, resource_object, def addCashLineToDelivery(self, delivery_object, line_id, line_portal_type, resource_object,
variation_base_category_list, variation_category_list, resource_quantity_dict): variation_base_category_list, variation_category_list, resource_quantity_dict):
""" """
""" """
base_id = 'movement' base_id = 'movement'
line_kwd = {'base_id':base_id} line_kwd = {'base_id':base_id}
line = delivery_object.newContent(id=line_id, portal_type=line_portal_type, line = delivery_object.newContent(id=line_id, portal_type=line_portal_type,
resource_value=resource_object, quantity_unit_value=self.unit) resource_value=resource_object, quantity_unit_value=self.unit)
line.setVariationBaseCategoryList(variation_base_category_list) line.setVariationBaseCategoryList(variation_base_category_list)
line.setVariationCategoryList(variation_category_list) line.setVariationCategoryList(variation_category_list)
line.updateCellRange(script_id='CashDetail_asCellRange', base_id=base_id) line.updateCellRange(script_id='CashDetail_asCellRange', base_id=base_id)
cell_range_key_list = line.getCellRangeKeyList(base_id=base_id) cell_range_key_list = line.getCellRangeKeyList(base_id=base_id)
if cell_range_key_list <> [[None, None]] : if cell_range_key_list <> [[None, None]] :
for k in cell_range_key_list: for k in cell_range_key_list:
category_list = filter(lambda k_item: k_item is not None, k) category_list = filter(lambda k_item: k_item is not None, k)
c = line.newCell(*k, **line_kwd) c = line.newCell(*k, **line_kwd)
mapped_value_list = ['price', 'quantity'] mapped_value_list = ['price', 'quantity']
c.edit(mapped_value_property_list=mapped_value_list c.edit( membership_criterion_category_list = category_list
,force_update=1 , mapped_value_property_list = mapped_value_list
,membership_criterion_category_list=category_list , category_list = category_list
,category_list=category_list , force_update = 1
) )
for variation in self.variation_list: for variation in self.variation_list:
cell = line.getCell('emission_letter/k', variation, 'cash_status/valid') cell = line.getCell('emission_letter/k', variation, 'cash_status/valid')
cell.setQuantity(resource_quantity_dict[variation]) cell.setQuantity(resource_quantity_dict[variation])
cell.setResourceValue(resource_object)
cell.setDestinationValue(self.caisse_1)
LOG("XXX set Resource Value >>>>>>",0, repr(resource_object))
LOG("XXX set Destination Value >>>>>>",0, repr(self.caisse_1))
LOG("XXX get Destination Value On Cell >>>>>>",0, repr(cell))
LOG("XXX get Destination Value >>>>>>",0, repr(cell.getDestinationValue()))
LOG("XXX get Baobab Destination Value >>>>>>",0, repr(cell.getBaobabDestinationValue()))
LOG("XXX get Destination UID >>>>>>",0, repr(cell.getDestinationUid()))
LOG("XXX get Baobab Destination UID >>>>>>",0, repr(cell.getBaobabDestinationUid()))
LOG("XXX getBaobabDestinationUID func >>>>>>",0, repr(getattr(cell, 'getBaobabDestinationUid', None)))
LOG("XXX func dict >>>>>>",0, repr(getattr(cell, 'getBaobabDestinationUid', None).__dict__))
LOG("XXX func module >>>>>>",0, repr(getattr(cell, 'getBaobabDestinationUid', None).__module__))
def getUserFolder(self): def getUserFolder(self):
...@@ -397,9 +411,11 @@ class TestERP5BankingCashTransfer(ERP5TypeTestCase): ...@@ -397,9 +411,11 @@ class TestERP5BankingCashTransfer(ERP5TypeTestCase):
self.tic() self.tic()
def stepFirstCheck(self, sequence=None, sequence_list=None, **kwd): def stepCheckObjects(self, sequence=None, sequence_list=None, **kwd):
""" """
Check that all the objects we created in afterSetUp or that were added by the business template and that we rely on are really here Check that all the objects we created in afterSetUp or
that were added by the business template and that we rely
on are really here.
""" """
# check that Categories were created # check that Categories were created
self.assertEqual(self.caisse_1.getPortalType(), 'Category') self.assertEqual(self.caisse_1.getPortalType(), 'Category')
...@@ -424,7 +440,11 @@ class TestERP5BankingCashTransfer(ERP5TypeTestCase): ...@@ -424,7 +440,11 @@ class TestERP5BankingCashTransfer(ERP5TypeTestCase):
self.assertEqual(self.cash_transfer_module.getPortalType(), 'Cash Transfer Module') self.assertEqual(self.cash_transfer_module.getPortalType(), 'Cash Transfer Module')
self.assertEqual(len(self.cash_transfer_module.objectValues()), 0) self.assertEqual(len(self.cash_transfer_module.objectValues()), 0)
# check inventory at source
def stepCheckInitialInventory(self, sequence=None, sequence_list=None, **kwd):
"""
Check the initial inventory.
"""
self.simulation_tool = self.getSimulationTool() self.simulation_tool = self.getSimulationTool()
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.caisse_1.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 5.0) self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.caisse_1.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 5.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.caisse_1.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 5.0) self.assertEqual(self.simulation_tool.getFutureInventory(node=self.caisse_1.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 5.0)
...@@ -729,7 +749,7 @@ class TestERP5BankingCashTransfer(ERP5TypeTestCase): ...@@ -729,7 +749,7 @@ class TestERP5BankingCashTransfer(ERP5TypeTestCase):
""" """
if not run: return if not run: return
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = 'Tic FirstCheck CheckSource CheckDestination' \ sequence_string = 'Tic CheckObjects Tic CheckInitialInventory CheckSource CheckDestination' \
+ ' CreateCashTransfer Tic CheckCashTransfer' \ + ' CreateCashTransfer Tic CheckCashTransfer' \
+ ' CreateValidLine1 Tic CheckValidLine1 CheckSubTotal' \ + ' CreateValidLine1 Tic CheckValidLine1 CheckSubTotal' \
+ ' CreateValidLine2 Tic CheckValidLine2 CheckTotal' \ + ' CreateValidLine2 Tic CheckValidLine2 CheckTotal' \
......
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