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