Commit 9f285279 authored by Aurel's avatar Aurel

add a better categories tree and more categories to do unit test


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6980 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5abd8298
...@@ -271,12 +271,14 @@ class TestERP5BankingMixin: ...@@ -271,12 +271,14 @@ class TestERP5BankingMixin:
# add the category valid in cash_status which define status of banknotes and coin # add the category valid in cash_status which define status of banknotes and coin
self.cash_status_valid = self.cash_status_base_category.newContent(id='valid', portal_type='Category') self.cash_status_valid = self.cash_status_base_category.newContent(id='valid', portal_type='Category')
self.cash_status_to_sort = self.cash_status_base_category.newContent(id='to_sort', portal_type='Category') self.cash_status_to_sort = self.cash_status_base_category.newContent(id='to_sort', portal_type='Category')
self.cash_status_cancelled = self.cash_status_base_category.newContent(id='cancelled', portal_type='Category')
self.emission_letter_base_category = getattr(self.category_tool, 'emission_letter') self.emission_letter_base_category = getattr(self.category_tool, 'emission_letter')
# add the category k in emission letter that will be used fo banknotes and coins # add the category k in emission letter that will be used fo banknotes and coins
self.emission_letter_k = self.emission_letter_base_category.newContent(id='k', portal_type='Category') self.emission_letter_p = self.emission_letter_base_category.newContent(id='p', portal_type='Category')
self.emission_letter_s = self.emission_letter_base_category.newContent(id='s', portal_type='Category')
self.emission_letter_b = self.emission_letter_base_category.newContent(id='b', portal_type='Category') self.emission_letter_b = self.emission_letter_base_category.newContent(id='b', portal_type='Category')
self.emission_letter_d = self.emission_letter_base_category.newContent(id='d', portal_type='Category') self.emission_letter_not_defined = self.emission_letter_base_category.newContent(id='not_defined', portal_type='Category')
self.variation_base_category = getattr(self.category_tool, 'variation') self.variation_base_category = getattr(self.category_tool, 'variation')
# add the category 1992 in variation # add the category 1992 in variation
...@@ -316,9 +318,12 @@ class TestERP5BankingMixin: ...@@ -316,9 +318,12 @@ class TestERP5BankingMixin:
self.gestionnaire_caisse_courante = self.banking.newContent(id='gestionnaire_caisse_courante', portal_type='Category', codification='CCO') self.gestionnaire_caisse_courante = self.banking.newContent(id='gestionnaire_caisse_courante', portal_type='Category', codification='CCO')
self.gestionnaire_caveau = self.banking.newContent(id='gestionnaire_caveau', portal_type='Category', codification='CCV') self.gestionnaire_caveau = self.banking.newContent(id='gestionnaire_caveau', portal_type='Category', codification='CCV')
self.caissier_particulier = self.banking.newContent(id='caissier_particulier', portal_type='Category', codification='CGU') self.caissier_particulier = self.banking.newContent(id='caissier_particulier', portal_type='Category', codification='CGU')
self.controleur_caisse_courante = self.banking.newContent(id='controleur_caisse_courante', portal_type='Category', codification='CCC')
self.controleur_caveau = self.banking.newContent(id='controleur_caveau', portal_type='Category', codification='CCA')
self.comptable = self.banking.newContent(id='comptable', portal_type='Category', codification='FXF') self.comptable = self.banking.newContent(id='comptable', portal_type='Category', codification='FXF')
self.chef_section = self.banking.newContent(id='chef_section_comptable', portal_type='Category', codification='FXS') self.chef_section = self.banking.newContent(id='chef_section_comptable', portal_type='Category', codification='FXS')
self.chef_comptable = self.banking.newContent(id='chef_comptable', portal_type='Category', codification='CCB') self.chef_comptable = self.banking.newContent(id='chef_comptable', portal_type='Category', codification='CCB')
self.chef_de_tri = self.banking.newContent(id='chef_de_tri', portal_type='Category', codification='CTR')
# get the base category group # get the base category group
self.group_base_category = getattr(self.category_tool, 'group') self.group_base_category = getattr(self.category_tool, 'group')
...@@ -329,32 +334,54 @@ class TestERP5BankingMixin: ...@@ -329,32 +334,54 @@ class TestERP5BankingMixin:
self.site_base_category = getattr(self.category_tool, '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 # 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', vault_type='site') self.testsite = self.site_base_category.newContent(id='testsite', portal_type='Category', codification='TEST', vault_type='site')
# add vault caisse_1 in testsite self.paris = self.testsite.newContent(id='paris', portal_type='Category', codification='P1', vault_type='site')
self.caisse_1 = self.testsite.newContent(id='caisse_1', portal_type='Category', codification='C1', vault_type='site/vault') self.madrid = self.testsite.newContent(id='madrid', portal_type='Category', codification='S1', vault_type='site')
# add vault caisse_2 in testsite
self.caisse_2 = self.testsite.newContent(id='caisse_2', portal_type='Category', codification='C2', vault_type='site/vault') for c in self.testsite.getCategoryChildValueList():
self.siegesite = self.site_base_category.newContent(id='siege', portal_type='Category', codification='SIEGE', vault_type='site') # create bank structure for each agency
self.agencesite = self.site_base_category.newContent(id='agence', portal_type='Category', codification='AGENCE', vault_type='site') site = c.getId()
self.principalesite = self.agencesite.newContent(id='principale', portal_type='Category', codification='PRINCIPALE', vault_type='site/vault') # surface
self.auxisite = self.agencesite.newContent(id='auxiliaire', portal_type='Category', codification='AUXILIAIRE', vault_type='site/vault') surface = c.newContent(id='surface', portal_type='Category', codification='', vault_type='site/surface')
self.encaisse_billets_et_monnaies = self.testsite.newContent(id='encaisse_des_billets_et_monnaies', portal_type='Category', codification='C1', vault_type='site/vault') caisse_courante = surface.newContent(id='caisse_courante', portal_type='Category', codification='', vault_type='site/surface/caisse_courante')
self.encaisse_externe = self.testsite.newContent(id='encaisse_des_externes', portal_type='Category', codification='C1', vault_type='site/vault') caisse_courante.newContent(id='encaisse_des_billets_et_monnaies', portal_type='Category', codification='', vault_type='site/surface/caisse_courante')
self.encaisse_ventilation = self.testsite.newContent(id='encaisse_des_billets_recus_pour_ventilation', portal_type='Category', codification='C1', vault_type='site/vault') # create counter for surface
self.caisse_lille = self.encaisse_ventilation.newContent(id='lille', portal_type='Category', codification='C1', vault_type='site/vault') for s in ['banque_interne', 'gros_versement', 'gros_payement']:
self.paris = self.principalesite.newContent(id='paris', portal_type='Category', codification='K00', vault_type='site/vault') s = surface.newContent(id='%s' %(s,), portal_type='Category', codification='', vault_type='site/surface/%s' %(s,))
for ss in ['guichet_1', 'guichet_2', 'guichet_3']:
ss = s.newContent(id='%s' %(ss,), portal_type='Category', codification='', vault_type='site/surface/%s' %(s,))
def openCounterDate(self, date=None): # create sort room
salle_de_tri = surface.newContent(id='salle_de_tri', portal_type='Category', codification='', vault_type='site/surface/salle_de_tri')
for ss in ['encaisse_des_billets_et_monnaies', 'encaisse_des_billets_recus_pour_ventilation']:
ss = salle_de_tri.newContent(id='%s' %(ss,), portal_type='Category', codification='', vault_type='site/surface/salle_de_tri')
if 'ventilation' in ss.getId():
for country in ['France', 'Spain']:
if country[0] != c.getCodification()[0]:
ss.newContent(id='%s' %(country,), portal_type='Category', codification='', vault_type='site/caveau/%s' %(s,))
# caveau
caveau = c.newContent(id='caveau', portal_type='Category', codification='', vault_type='site/caveau')
for s in ['auxiliaire', 'reserve', 'externes']:
s = caveau.newContent(id='%s' %(s,), portal_type='Category', codification='', vault_type='site/caveau/%s' %(s,))
for ss in ['encaisse_des_billets_et_monnaies', 'encaisse_des_externes', 'encaisse_des_billets_recus_pour_ventilation']:
ss = s.newContent(id='%s' %(ss,), portal_type='Category', codification='', vault_type='site/caveau/%s' %(s,))
if 'ventilation' in ss.getId():
for country in ['France', 'Spain']:
if country[0] != c.getCodification()[0]:
ss.newContent(id='%s' %(country,), portal_type='Category', codification='', vault_type='site/caveau/%s' %(s,))
def openCounterDate(self, date=None, site=None):
""" """
open a couter date fort the given date open a couter date fort the given date
by default use the current date by default use the current date
""" """
if date is None: if date is None:
date = DateTime().Date() date = DateTime().Date()
if site is None:
site = self.testsite
# create a counter date # create a counter date
self.counter_date_module = self.getCounterDateModule() self.counter_date_module = self.getCounterDateModule()
self.counter_date = self.counter_date_module.newContent(id='counter_date_1', portal_type="Counter Date", self.counter_date = self.counter_date_module.newContent(id='counter_date_1', portal_type="Counter Date",
site_value = self.testsite, site_value = site,
start_date = date) start_date = date)
# open the counter date # open the counter date
self.counter_date.open() self.counter_date.open()
...@@ -549,7 +576,7 @@ class TestERP5BankingMixin: ...@@ -549,7 +576,7 @@ class TestERP5BankingMixin:
Check that all have been create after setup Check that all have been create after setup
""" """
# check that Categories were created # check that Categories were created
self.assertEqual(self.encaisse_billets_et_monnaies.getPortalType(), 'Category') self.assertEqual(self.paris.getPortalType(), 'Category')
# check that Resources were created # check that Resources were created
# check portal type of billet_10000 # check portal type of billet_10000
......
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