[Erp5-report] r37775 luke - /erp5/trunk/products/ERP5/tests/testSupply.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Aug 12 16:41:01 CEST 2010


Author: luke
Date: Thu Aug 12 16:40:57 2010
New Revision: 37775

URL: http://svn.erp5.org?rev=37775&view=rev
Log:
 - add tests for subcontent reindexing for Purchase, Sale and Internal Supply
 - add tests for subcontent reindexing for Internal, Purchase, Sale and "generic" Supply Lines

Modified:
    erp5/trunk/products/ERP5/tests/testSupply.py

Modified: erp5/trunk/products/ERP5/tests/testSupply.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testSupply.py?rev=37775&r1=37774&r2=37775&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testSupply.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testSupply.py [utf8] Thu Aug 12 16:40:57 2010
@@ -32,6 +32,7 @@ import unittest
 import transaction
 from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
 from Products.ERP5Type.tests.utils import reindex
+from Products.ERP5Type.tests.utils import SubcontentReindexingWrapper
 from DateTime import DateTime
 
 class TestSupplyMixin:
@@ -58,7 +59,8 @@ class TestSupplyMixin:
     module.manage_delObjects(list(module.objectIds()))
     self.stepTic()
 
-class TestSaleSupply(TestSupplyMixin, ERP5TypeTestCase):
+class TestSaleSupply(TestSupplyMixin, SubcontentReindexingWrapper,
+    ERP5TypeTestCase):
   """
     Test Supplies usage
   """
@@ -67,6 +69,9 @@ class TestSaleSupply(TestSupplyMixin, ER
   supply_portal_type = 'Sale Supply'
   supply_line_portal_type = 'Sale Supply Line'
   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):
     return "Sale Supply"
@@ -240,6 +245,49 @@ class TestSaleSupply(TestSupplyMixin, ER
     supply_line.setDestinationReference('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):
   """
     Test Purchase Supplies usage




More information about the Erp5-report mailing list