Commit a3aecce2 authored by Aurel's avatar Aurel Committed by Arnaud Fontaine

manage_delObject raise when no ids given

parent b581472e
...@@ -29,6 +29,7 @@ import unittest ...@@ -29,6 +29,7 @@ import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.utils import createZODBPythonScript from Products.ERP5Type.tests.utils import createZODBPythonScript
from erp5.component.test.testOrder import TestOrderMixin from erp5.component.test.testOrder import TestOrderMixin
from zExceptions import BadRequest
class TestRuleMixin(TestOrderMixin): class TestRuleMixin(TestOrderMixin):
""" """
...@@ -52,13 +53,19 @@ class TestRuleMixin(TestOrderMixin): ...@@ -52,13 +53,19 @@ class TestRuleMixin(TestOrderMixin):
return rule return rule
def _wipe(self, folder): def _wipe(self, folder):
folder.manage_delObjects(list(folder.objectIds())) try:
folder.manage_delObjects(list(folder.objectIds()))
except BadRequest:
pass
def afterSetUp(self): def afterSetUp(self):
# delete rules # delete rules
rule_tool = self.portal.portal_rules rule_tool = self.portal.portal_rules
rule_tool.manage_delObjects(ids=[x.getId() for x in rule_tool.objectValues() try:
if x.getVersion().startswith('testRule.')]) rule_tool.manage_delObjects(ids=[x.getId() for x in rule_tool.objectValues()
if x.getVersion().startswith('testRule.')])
except BadRequest:
pass
# recreate rules # recreate rules
self.createRule('default_order_rule', '1') self.createRule('default_order_rule', '1')
self.createRule('default_delivery_rule', '1') self.createRule('default_delivery_rule', '1')
......
...@@ -54,6 +54,7 @@ from erp5.component.test.testOrder import TestOrderMixin ...@@ -54,6 +54,7 @@ from erp5.component.test.testOrder import TestOrderMixin
from Products.ERP5Form.Selection import DomainSelection from Products.ERP5Form.Selection import DomainSelection
from Products.ERP5Type.tests.utils import createZODBPythonScript from Products.ERP5Type.tests.utils import createZODBPythonScript
from textwrap import dedent from textwrap import dedent
from zExceptions import BadRequest
class TestInventory(TestOrderMixin, ERP5TypeTestCase): class TestInventory(TestOrderMixin, ERP5TypeTestCase):
""" """
...@@ -115,7 +116,10 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase): ...@@ -115,7 +116,10 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase):
for module in [ 'portal_simulation', for module in [ 'portal_simulation',
'inventory_module']: 'inventory_module']:
folder = self.portal[module] folder = self.portal[module]
folder.manage_delObjects(list(folder.objectIds())) try:
folder.manage_delObjects(list(folder.objectIds()))
except BadRequest:
pass
self.portal.portal_skins.custom.manage_delObjects( self.portal.portal_skins.custom.manage_delObjects(
list(self.portal.portal_skins.custom.objectIds())) list(self.portal.portal_skins.custom.objectIds()))
......
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