Commit 8d657b07 authored by Jérome Perrin's avatar Jérome Perrin

some fixs to budget test, but still not working.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10088 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 752209c6
...@@ -65,20 +65,17 @@ class TestBudget(ERP5TypeTestCase): ...@@ -65,20 +65,17 @@ class TestBudget(ERP5TypeTestCase):
RUN_ALL_TEST = 1 RUN_ALL_TEST = 1
QUIET = 0 QUIET = 0
def getTitle(self): def getTitle(self):
""" """
Return the title of the current test set. Return the title of the current test set.
""" """
return "ERP5 Budget" return "ERP5 Budget"
def getBusinessTemplateList(self): def getBusinessTemplateList(self):
""" """
Return the list of required business templates. Return the list of required business templates.
""" """
return ('erp5_base','erp5_pdm', 'erp5_trade', 'erp5_accounting', 'erp5_budget') return ('erp5_base', 'erp5_pdm', 'erp5_trade', 'erp5_accounting', 'erp5_budget')
def login(self, quiet=QUIET, run=RUN_ALL_TEST): def login(self, quiet=QUIET, run=RUN_ALL_TEST):
""" """
...@@ -148,12 +145,10 @@ class TestBudget(ERP5TypeTestCase): ...@@ -148,12 +145,10 @@ class TestBudget(ERP5TypeTestCase):
self.organisation_module = self.getOrganisationModule() self.organisation_module = self.getOrganisationModule()
budget_module = self.getBudgetModule() budget_module = self.getBudgetModule()
budget_transaction_module = self.getBudgetTransactionModule() budget_transaction_module = self.getBudgetTransactionModule()
self.portal = self.getPortal()
self.getAccountingModule().manage_addLocalRoles('maurice', ('Assignor','Assignee','Manager','Owner',)) self.getAccountingModule().manage_addLocalRoles('maurice', ('Assignor','Assignee','Manager','Owner',))
# flush activities # flush activities
get_transaction().commit() get_transaction().commit()
self.tic() self.tic()
# When using light install, only base categories are created # When using light install, only base categories are created
if len(self.portal_categories.region.contentValues()) == 0 : if len(self.portal_categories.region.contentValues()) == 0 :
o = self.portal_categories.region.newContent(portal_type='Category', id='europe') o = self.portal_categories.region.newContent(portal_type='Category', id='europe')
...@@ -231,7 +226,11 @@ class TestBudget(ERP5TypeTestCase): ...@@ -231,7 +226,11 @@ class TestBudget(ERP5TypeTestCase):
) )
budget_cell2.setQuantity(1000.0) budget_cell2.setQuantity(1000.0)
budget_transfert1 = budget1.newContent(portal_type='Budget Transfert Line',source=budget_cell1.getRelativeUrl(), resource='currency/EUR',destination =budget_cell2.getRelativeUrl(),quantity=500.0) budget_transfert1 = budget1.newContent(portal_type='Budget Transfer Line',
source=budget_cell1.getRelativeUrl(),
resource='currency/EUR',
destination=budget_cell2.getRelativeUrl(),
quantity=500.0)
self.budget_transaction1 = budget_transaction_module.newContent(portal_type='Budget Transaction',source =budget_cell1.getRelativeUrl(), destination=budget_cell2.getRelativeUrl(), quantity=25.0,group='world_company', stop_date='2005/05/01 18:06:26.388 GMT-4') self.budget_transaction1 = budget_transaction_module.newContent(portal_type='Budget Transaction',source =budget_cell1.getRelativeUrl(), destination=budget_cell2.getRelativeUrl(), quantity=25.0,group='world_company', stop_date='2005/05/01 18:06:26.388 GMT-4')
...@@ -241,28 +240,18 @@ class TestBudget(ERP5TypeTestCase): ...@@ -241,28 +240,18 @@ class TestBudget(ERP5TypeTestCase):
get_transaction().commit() get_transaction().commit()
self.tic() self.tic()
def getAccountModule(self): def getAccountModule(self):
return getattr(self.getPortal(), 'account_module', None) return getattr(self.getPortal(), 'account_module', None)
def getAccountingModule(self): def getAccountingModule(self):
return getattr(self.getPortal(), 'accounting_module', None) return getattr(self.getPortal(), 'accounting_module', None)
def getOrganisationModule(self):
return getattr(self.getPortal(), 'organisation', None)
def getBudgetModule(self): def getBudgetModule(self):
return getattr(self.getPortal(), 'budget_module', None) return getattr(self.getPortal(), 'budget_module', None)
def getBudgetTransactionModule(self): def getBudgetTransactionModule(self):
return getattr(self.getPortal(), 'budget_transaction_module', None) return getattr(self.getPortal(), 'budget_transaction_module', None)
def getCurrencyModule(self) :
return getattr(self.getPortal(), 'currency', None)
def createCategories(self): def createCategories(self):
""" """
Create some categories for testing. Create some categories for testing.
...@@ -379,7 +368,6 @@ class TestBudget(ERP5TypeTestCase): ...@@ -379,7 +368,6 @@ class TestBudget(ERP5TypeTestCase):
LOG('Testing... ',0,'testHasBudgetCells') LOG('Testing... ',0,'testHasBudgetCells')
message = "" message = ""
len_cells = 0 len_cells = 0
self.afterSetUp()
for objects in self.getBudgetModule().budget_module.objectValues(): for objects in self.getBudgetModule().budget_module.objectValues():
if objects.getPortalType() == 'Budget': if objects.getPortalType() == 'Budget':
for obj_line in objects.objectValues(): for obj_line in objects.objectValues():
...@@ -407,7 +395,6 @@ class TestBudget(ERP5TypeTestCase): ...@@ -407,7 +395,6 @@ class TestBudget(ERP5TypeTestCase):
message = 'Test if there is enough budget before validating an accounting transaction' message = 'Test if there is enough budget before validating an accounting transaction'
ZopeTestCase._print('\n%s ' % message) ZopeTestCase._print('\n%s ' % message)
LOG('Testing... ',0,message) LOG('Testing... ',0,message)
self.afterSetUp()
self.stepConfirmAccountingTransaction(self.accounting_transaction1) self.stepConfirmAccountingTransaction(self.accounting_transaction1)
message = str(self.accounting_transaction1.getSimulationState()) message = str(self.accounting_transaction1.getSimulationState())
ZopeTestCase._print('\n%s ' % message) ZopeTestCase._print('\n%s ' % message)
...@@ -445,7 +432,6 @@ class TestBudget(ERP5TypeTestCase): ...@@ -445,7 +432,6 @@ class TestBudget(ERP5TypeTestCase):
message = 'Test if the transaction of budget is authorized' message = 'Test if the transaction of budget is authorized'
ZopeTestCase._print('\n%s ' % message) ZopeTestCase._print('\n%s ' % message)
LOG('Testing... ',0,message) LOG('Testing... ',0,message)
self.afterSetUp()
self.stepDeliverBudgetTransaction(self.budget_transaction1) self.stepDeliverBudgetTransaction(self.budget_transaction1)
message = str(self.budget_transaction1.getSimulationState()) message = str(self.budget_transaction1.getSimulationState())
ZopeTestCase._print('\n%s ' % message) ZopeTestCase._print('\n%s ' % message)
......
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