Commit 5591d71a authored by Jérome Perrin's avatar Jérome Perrin

a few more tests, and some TODO notes


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31346 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f136e190
...@@ -33,11 +33,12 @@ from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase ...@@ -33,11 +33,12 @@ from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
class TestBudget(ERP5TypeTestCase): class TestBudget(ERP5TypeTestCase):
def getBusinessTemplateList(self): def getBusinessTemplateList(self):
""" """Return the list of required business templates.
Return the list of required business templates. We'll use erp5_accounting_ui_test to have some content
""" """
return ('erp5_base', 'erp5_pdm', 'erp5_trade', 'erp5_accounting', return ('erp5_base', 'erp5_pdm', 'erp5_trade', 'erp5_accounting',
'erp5_invoicing', 'erp5_simplified_invoicing', 'erp5_budget') 'erp5_invoicing', 'erp5_simplified_invoicing',
'erp5_accounting_ui_test', 'erp5_budget')
def test_simple_create_budget_model(self): def test_simple_create_budget_model(self):
budget_model = self.portal.budget_model_module.newContent( budget_model = self.portal.budget_model_module.newContent(
...@@ -47,7 +48,7 @@ class TestBudget(ERP5TypeTestCase): ...@@ -47,7 +48,7 @@ class TestBudget(ERP5TypeTestCase):
int_index=1, int_index=1,
budget_variation='budget_cell', budget_variation='budget_cell',
inventory_axis='node_category', inventory_axis='node_category',
variation_category='site', variation_base_category='site',
) )
self.assertEquals([], budget_model.checkConsistency()) self.assertEquals([], budget_model.checkConsistency())
...@@ -55,8 +56,59 @@ class TestBudget(ERP5TypeTestCase): ...@@ -55,8 +56,59 @@ class TestBudget(ERP5TypeTestCase):
budget = self.portal.budget_module.newContent( budget = self.portal.budget_module.newContent(
portal_type='Budget') portal_type='Budget')
budget_line = budget.newContent(portal_type='Budget Line') budget_line = budget.newContent(portal_type='Budget Line')
budget_cell = budget_line.newContent(portal_type='Budget Cell')
self.assertEquals([], budget.checkConsistency()) self.assertEquals([], budget.checkConsistency())
def test_budget_cell_node_variation_with_aggregate(self):
budget_model = self.portal.budget_model_module.newContent(
portal_type='Budget Model')
budget_model.newContent(
portal_type='Node Budget Variation',
int_index=1,
budget_variation='budget_cell',
inventory_axis='node',
variation_base_category='source',
aggregate_value_list=(
self.portal.account_module.goods_purchase,
self.portal.account_module.fixed_assets,
))
budget = self.portal.budget_module.newContent(
portal_type='Budget',
specialise_value=budget_model)
budget_line = budget.newContent(portal_type='Budget Line')
self.assertEquals(['source'],
budget_line.getVariationBaseCategoryList())
self.assertEquals(
[('Goods Purchase', 'source/account_module/goods_purchase'),
('Fixed Assets', 'source/account_module/fixed_assets')],
budget_line.BudgetLine_getVariationRangeCategoryList())
budget_line.setVariationCategoryList(
('source/account_module/goods_purchase',))
self.assertEquals(
['source/account_module/goods_purchase'],
budget_line.getVariationCategoryList())
# This was a budget cell variation, so no criterion is set on budget line
self.assertEquals(budget_line.getMembershipCriterionCategoryList(), [])
self.assertEquals(
budget_line.getMembershipCriterionBaseCategoryList(), [])
# TODO: create cells and test variation on cell
# Other TODOs
# test simple category variation in getInventory
# test that using a category variation on budget level sets membership
# criterion on budget
# test that using a variation on budget line level sets membership
# criterion on budget line (and budget cell or not ?)
# test that using a category variation on budget level is used in inventory
# calculation
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
......
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