Commit 28db3a9c authored by Julien Muchembled's avatar Julien Muchembled

testAccountingRules: use XMLMatrix API instead of guessing cell ids

parent 16e7b5d0
...@@ -270,8 +270,6 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase): ...@@ -270,8 +270,6 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase):
def stepUpdateInvoiceTransactionRuleMatrix(self, sequence, **kw) : def stepUpdateInvoiceTransactionRuleMatrix(self, sequence, **kw) :
"""Creates/updates the matrix of the sale invoice transaction rule """ """Creates/updates the matrix of the sale invoice transaction rule """
invoice_transaction_rule = sequence.get('invoice_transaction_rule') invoice_transaction_rule = sequence.get('invoice_transaction_rule')
base_id = 'movement'
kwd = {'base_id': base_id}
# update the matrix, generates the accounting rule cells # update the matrix, generates the accounting rule cells
invoice_transaction_rule.edit() invoice_transaction_rule.edit()
...@@ -280,31 +278,19 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase): ...@@ -280,31 +278,19 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase):
# check the accounting rule cells inside the matrix # check the accounting rule cells inside the matrix
cell_list = invoice_transaction_rule.contentValues( cell_list = invoice_transaction_rule.contentValues(
filter = {'portal_type':self.accounting_rule_cell_portal_type}) portal_type=self.accounting_rule_cell_portal_type)
self.assertEqual(len(cell_list), 4) kw = dict(
product_notebook_region_france_cell=invoice_transaction_rule.getCell(
# In the matrix, cells are named on the scheme : 'product_notebook', 'region_france', base_id='movement'),
# ${base_id} + '_'.join(predicate_dimension ordered by int_index) product_notebook_region_africa_cell=invoice_transaction_rule.getCell(
product_notebook_region_france_cell = getattr(invoice_transaction_rule, 'product_notebook', 'region_africa', base_id='movement'),
'%s_0_0'%base_id, None) product_barebone_region_france_cell=invoice_transaction_rule.getCell(
product_notebook_region_africa_cell = getattr(invoice_transaction_rule, 'product_barebone', 'region_france', base_id='movement'),
'%s_0_1'%base_id, None) product_barebone_region_africa_cell=invoice_transaction_rule.getCell(
product_barebone_region_france_cell = getattr(invoice_transaction_rule, 'product_barebone', 'region_africa', base_id='movement'),
'%s_1_0'%base_id, None)
product_barebone_region_africa_cell = getattr(invoice_transaction_rule,
'%s_1_1'%base_id, None)
self.failUnless(product_notebook_region_france_cell != None)
self.failUnless(product_notebook_region_africa_cell != None)
self.failUnless(product_barebone_region_france_cell != None)
self.failUnless(product_barebone_region_africa_cell != None)
sequence.edit(
product_notebook_region_france_cell = product_notebook_region_france_cell,
product_notebook_region_africa_cell = product_notebook_region_africa_cell,
product_barebone_region_france_cell = product_barebone_region_france_cell,
product_barebone_region_africa_cell = product_barebone_region_africa_cell,
) )
self.assertSameSet(cell_list, kw.values())
sequence.edit(**kw)
def stepValidateInvoiceTransaction(self, sequence, **kw) : def stepValidateInvoiceTransaction(self, sequence, **kw) :
"""validates the sale invoice transaction rule""" """validates the sale invoice transaction rule"""
......
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