Commit 48bdc99f authored by Łukasz Nowak's avatar Łukasz Nowak

- add test similar to [35329] to check if acquired parameters of order are...

 - add test similar to [35329] to check if acquired parameters of order are properly indexed for order's subobjects


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36225 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent fb30295b
...@@ -2840,6 +2840,66 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -2840,6 +2840,66 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
# TODO: test with cells ? # TODO: test with cells ?
def test_subcontent_reindexing(self):
"""Tests, that modification on Order are propagated to lines and cells
during reindxation"""
organisation1 = self.portal.organisation_module.newContent(
portal_type='Organisation')
organisation2 = self.portal.organisation_module.newContent(
portal_type='Organisation')
order = self.portal.getDefaultModule(self.order_portal_type).newContent(
portal_type=self.order_portal_type,
source_value=organisation1)
order_line = order.newContent(portal_type=self.order_line_portal_type)
inner_order_line = order.newContent(portal_type=self.order_line_portal_type
).newContent(portal_type=self.order_line_portal_type)
order_cell = order.newContent(portal_type=self.order_line_portal_type)\
.newContent(portal_type=self.order_cell_portal_type)
self.stepTic()
# self-tests...
# ...assertions of acquisition
source, source_uid = order.getSource(), order.getSourceUid()
self.assertEqual(source, order_line.getSource())
self.assertEqual(source, inner_order_line.getSource())
self.assertEqual(source, order_cell.getSource())
# ...assertions that only acquisition is used
self.assertFalse('source/'+source in order_line.getCategoryList())
self.assertFalse('source/'+source in inner_order_line.getCategoryList())
self.assertFalse('source/'+source in order_cell.getCategoryList())
# ...assertions that they are movement
self.assertTrue(order_line.isMovement())
self.assertTrue(order_cell.isMovement())
self.assertTrue(inner_order_line.isMovement())
# real assertions
kw = {"movement.source_uid":source_uid}
catalog_tool = self.portal.portal_catalog
self.assertEqual(1, len(catalog_tool(uid=order.getUid(),
source_relative_url=source)))
self.assertEqual(1, len(catalog_tool(uid=order_line.getUid(), **kw)))
self.assertEqual(1, len(catalog_tool(uid=inner_order_line.getUid(), **kw)))
self.assertEqual(1, len(catalog_tool(uid=order_cell.getUid(), **kw)))
# change to different source
order.setSourceValue(organisation2)
self.stepTic()
# ...assertions of acquisition
source, source_uid = order.getSource(), order.getSourceUid()
self.assertEqual(source, order_line.getSource())
self.assertEqual(source, inner_order_line.getSource())
self.assertEqual(source, order_cell.getSource())
# ...assertions that only acquisition is used
self.assertFalse('source/'+source in order_line.getCategoryList())
self.assertFalse('source/'+source in inner_order_line.getCategoryList())
self.assertFalse('source/'+source in order_cell.getCategoryList())
# real assertions
kw = {"movement.source_uid":source_uid}
catalog_tool = self.portal.portal_catalog
self.assertEqual(1, len(catalog_tool(uid=order.getUid(),
source_relative_url=source)))
self.assertEqual(1, len(catalog_tool(uid=order_line.getUid(), **kw)))
self.assertEqual(1, len(catalog_tool(uid=inner_order_line.getUid(), **kw)))
self.assertEqual(1, len(catalog_tool(uid=order_cell.getUid(), **kw)))
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
......
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