Commit 7a1ff707 authored by Łukasz Nowak's avatar Łukasz Nowak

- add tests for subcontent reindexing for Purchase, Sale and Internal Supply

 - add tests for subcontent reindexing for Internal, Purchase, Sale and "generic" Supply Lines


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@37775 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 06095ed5
...@@ -32,6 +32,7 @@ import unittest ...@@ -32,6 +32,7 @@ import unittest
import transaction import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.utils import reindex from Products.ERP5Type.tests.utils import reindex
from Products.ERP5Type.tests.utils import SubcontentReindexingWrapper
from DateTime import DateTime from DateTime import DateTime
class TestSupplyMixin: class TestSupplyMixin:
...@@ -58,7 +59,8 @@ class TestSupplyMixin: ...@@ -58,7 +59,8 @@ class TestSupplyMixin:
module.manage_delObjects(list(module.objectIds())) module.manage_delObjects(list(module.objectIds()))
self.stepTic() self.stepTic()
class TestSaleSupply(TestSupplyMixin, ERP5TypeTestCase): class TestSaleSupply(TestSupplyMixin, SubcontentReindexingWrapper,
ERP5TypeTestCase):
""" """
Test Supplies usage Test Supplies usage
""" """
...@@ -67,6 +69,9 @@ class TestSaleSupply(TestSupplyMixin, ERP5TypeTestCase): ...@@ -67,6 +69,9 @@ class TestSaleSupply(TestSupplyMixin, ERP5TypeTestCase):
supply_portal_type = 'Sale Supply' supply_portal_type = 'Sale Supply'
supply_line_portal_type = 'Sale Supply Line' supply_line_portal_type = 'Sale Supply Line'
supply_cell_portal_type = 'Sale Supply Cell' supply_cell_portal_type = 'Sale Supply Cell'
generic_supply_line_portal_type = 'Supply Line'
generic_supply_cell_portal_type = 'Supply Cell'
predicate_portal_type = 'Predicate'
def getTitle(self): def getTitle(self):
return "Sale Supply" return "Sale Supply"
...@@ -240,6 +245,49 @@ class TestSaleSupply(TestSupplyMixin, ERP5TypeTestCase): ...@@ -240,6 +245,49 @@ class TestSaleSupply(TestSupplyMixin, ERP5TypeTestCase):
supply_line.setDestinationReference('my_destination_reference') supply_line.setDestinationReference('my_destination_reference')
self.assertEquals(supply_line.getDestinationReference(), 'my_destination_reference') self.assertEquals(supply_line.getDestinationReference(), 'my_destination_reference')
def test_subcontent_reindexing_supply(self):
"""Tests, that modification on Supply are propagated to children"""
supply = self.portal.getDefaultModule(self.supply_portal_type).newContent(
portal_type=self.supply_portal_type)
supply_line = supply.newContent(portal_type=self.supply_line_portal_type)
supply_cell = supply_line.newContent(
portal_type=self.supply_cell_portal_type)
supply_line_predicate = supply_line.newContent(
portal_type=self.predicate_portal_type)
generic_supply_line = supply.newContent(
portal_type=self.generic_supply_line_portal_type)
generic_supply_cell = generic_supply_line.newContent(
portal_type=self.generic_supply_cell_portal_type)
generic_supply_predicate = generic_supply_line.newContent(
portal_type=self.predicate_portal_type)
self._testSubContentReindexing(supply, [supply_line, supply_cell,
supply_line_predicate, generic_supply_line, generic_supply_cell, generic_supply_predicate])
def test_subcontent_reindexing_supply_line(self):
"""Tests, that modification on Supply Line are propagated to children"""
supply = self.portal.getDefaultModule(self.supply_portal_type).newContent(
portal_type=self.supply_portal_type)
supply_line = supply.newContent(portal_type=self.supply_line_portal_type)
supply_cell = supply_line.newContent(
portal_type=self.supply_cell_portal_type)
supply_line_predicate = supply_line.newContent(
portal_type=self.predicate_portal_type)
generic_supply_line = supply.newContent(
portal_type=self.generic_supply_line_portal_type)
generic_supply_cell = generic_supply_line.newContent(
portal_type=self.generic_supply_cell_portal_type)
generic_supply_predicate = generic_supply_line.newContent(
portal_type=self.predicate_portal_type)
self._testSubContentReindexing(supply_line, [supply_cell,
supply_line_predicate])
self._testSubContentReindexing(generic_supply_line, [generic_supply_cell,
generic_supply_predicate])
class TestPurchaseSupply(TestSaleSupply): class TestPurchaseSupply(TestSaleSupply):
""" """
Test Purchase Supplies usage Test Purchase Supplies usage
......
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