Commit fc693a8b authored by Sebastien Robin's avatar Sebastien Robin

simulation: use portal type instances in tests instead of just classes

This allows code of movement group to still works when they use
setter/getters defined by property sheets
parent b0d269b1
...@@ -442,12 +442,11 @@ class TestMovementGroupCommonAPI(MovementGroupTestCase): ...@@ -442,12 +442,11 @@ class TestMovementGroupCommonAPI(MovementGroupTestCase):
def test_separateMethod(self): def test_separateMethod(self):
"""Make sure that _separate method works if argument is an empty list.""" """Make sure that _separate method works if argument is an empty list."""
import Products.ERP5Type.Document import Products.ERP5Type.Document
for name in Products.ERP5Type.Document.__dict__: for portal_type in self.portal.portal_types.objectValues():
if name[0].isupper() and name.endswith('MovementGroup'): portal_type_id = portal_type.getId()
module = getattr(Products.ERP5Type.Document, name) if portal_type_id.endswith("Movement Group"):
class_ = getattr(module, name) movement_group = self.builder.newContent(portal_type=portal_type_id)
instance = class_('dummy') self.assertEqual(movement_group._separate([]), [])
self.assertEqual(instance._separate([]), [])
class TestPropertyGroupingMovementGroup(MovementGroupTestCase): class TestPropertyGroupingMovementGroup(MovementGroupTestCase):
......
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