[Erp5-report] r36608 jm - /erp5/trunk/products/ERP5Type/tests/testCopySupport.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Jun 25 18:10:55 CEST 2010


Author: jm
Date: Fri Jun 25 18:10:55 2010
New Revision: 36608

URL: http://svn.erp5.org?rev=36608&view=rev
Log:
Add unit test to check dependencies between reindex and unindex activities

Modified:
    erp5/trunk/products/ERP5Type/tests/testCopySupport.py

Modified: erp5/trunk/products/ERP5Type/tests/testCopySupport.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/testCopySupport.py?rev=36608&r1=36607&r2=36608&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/testCopySupport.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/testCopySupport.py [utf8] Fri Jun 25 18:10:55 2010
@@ -87,5 +87,27 @@ class TestCopySupport(ERP5TypeTestCase):
     self.assertTrue(person.getCareerSubordination().startswith('organisation_module'))
     self.assertTrue(person.getCareerSubordinationValue().aq_base is organisation.aq_base)
 
-if __name__ == '__main__':
-  unittest.main()
+  def test_02_unindexObjectDependency(self):
+    # XXX This test passes for bad reasons.
+    person = self.portal.person_module.newContent(portal_type='Person',
+                                                  address_city='Lille')
+    transaction.commit()
+    self.tic()
+    person.recursiveReindexObject()
+    person.default_address.setId('old_address')
+    person.setAddressCity('Paris')
+    transaction.commit()
+    # Currently, the test passes only because ActivityTool.distribute always
+    # iterates on queues in the same order: SQLQueue before SQLDict.
+    # If Python returned dictionary values in a different order,
+    # reindex activities fail with the following error:
+    #   uid of <Products.ERP5Catalog.CatalogTool.IndexableObjectWrapper for
+    #   /erp5/person_module/1/old_address> is 599L and is already assigned
+    #   to deleted in catalog !!! This can be fatal.
+    # This test would also fail if SQLDict was used for 'unindexObject'.
+    self.tic()
+
+def test_suite():
+  suite = unittest.TestSuite()
+  suite.addTest(unittest.makeSuite(TestCopySupport))
+  return suite




More information about the Erp5-report mailing list