Commit 303d21dd authored by Julien Muchembled's avatar Julien Muchembled

ERP5TypeTestCase: new getRule method

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40002 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent eea16790
......@@ -43,17 +43,15 @@ class TestDivergenceTester(TestPackingListMixin, ERP5TypeTestCase):
def getTitle(self):
return "Divergence Tester"
def getRule(self):
rule_reference = 'default_delivering_rule'
return self.portal.portal_rules.searchFolder(reference=rule_reference,
validation_state="validated", sort_on='version',
sort_order='descending')[0].getObject()
def getDeliveringRule(self):
return self.getRule(reference='default_delivering_rule',
validation_state="validated")
def afterSetUp(self):
"""
Remove all divergence testers from order_rule.
"""
rule = self.getRule()
rule = self.getDeliveringRule()
tester_list = rule.contentValues(
portal_type=rule.getPortalDivergenceTesterTypeList())
rule.deleteContent([x.getId() for x in tester_list])
......@@ -108,7 +106,7 @@ class TestDivergenceTester(TestPackingListMixin, ERP5TypeTestCase):
packing_list = sql_result[0].getObject()
# XXX Hardcoded id
movement=packing_list['1']
rule = self.getRule()
rule = self.getDeliveringRule()
sequence.edit(
packing_list=packing_list,
movement=movement,
......
......@@ -110,10 +110,6 @@ class TestCommerce(ERP5TypeTestCase):
'erp5_commerce',
'erp5_simulation_test')
def getRule(self, **kw):
return self.portal.portal_rules.searchFolder(
sort_on='version', sort_order='descending', **kw)[0].getObject()
def afterSetUp(self):
uf = self.getPortal().acl_users
uf._doAddUser('ivan', '', ['Manager'], [])
......
......@@ -185,10 +185,6 @@ class InventoryAPITestCase(ERP5TypeTestCase):
'erp5_trade', 'erp5_apparel', 'erp5_project',
'erp5_simulation_test')
def getRule(self, **kw):
return self.portal.portal_rules.searchFolder(
sort_on='version', sort_order='descending', **kw)[0].getObject()
# TODO: move this to a base class {{{
@reindex
def _makeOrganisation(self, **kw):
......
......@@ -60,10 +60,6 @@ class TestMRPMixin(TestBPMMixin):
if rule.getValidationState() == 'validated':
rule.invalidate()
def getRule(self, **kw):
return self.portal.portal_rules.searchFolder(
sort_on='version', sort_order='descending', **kw)[0].getObject()
def _createDocument(self, portal_type, **kw):
module = self.portal.getDefaultModule(
portal_type=portal_type)
......
......@@ -712,6 +712,10 @@ class ERP5TypeTestCase(ProcessingNodeTestCase, PortalTestCase):
# reset aq_dynamic cache
_aq_reset()
def getRule(self, **kw):
return self.portal.portal_rules.searchFolder(
sort_on='version', sort_order='descending', **kw)[0].getObject()
def validateRules(self):
"""
try to validate all rules in rule_tool.
......
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