Commit 5028ae92 authored by Aurel's avatar Aurel Committed by Arnaud Fontaine

manage_delObject raise when no ids given

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