[Erp5-report] r35672 jerome - /erp5/trunk/products/ERP5/tests/testBusinessTemplate.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu May 27 12:02:49 CEST 2010


Author: jerome
Date: Thu May 27 12:02:36 2010
New Revision: 35672

URL: http://svn.erp5.org?rev=35672&view=rev
Log:
Make sure updated path are still in catalog after update.
(this test passes, I was suspecting unindex and reindex race condition)

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

Modified: erp5/trunk/products/ERP5/tests/testBusinessTemplate.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testBusinessTemplate.py?rev=35672&r1=35671&r2=35672&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testBusinessTemplate.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testBusinessTemplate.py [utf8] Thu May 27 12:02:36 2010
@@ -6547,6 +6547,54 @@
     self.assertNotEquals(None,
         self.portal.portal_actions.getActionInfo('object_view/test_global_action'))
 
+  def test_indexation_of_updated_path_item(self):
+    """Tests indexation on updated paths item.
+    They should keep their uid and still be available to catalog
+    This test is similar to test_40_BusinessTemplateUidOfCategoriesUnchanged,
+    but it also checks the object is available to catalog.
+    """
+    self.portal.newContent(
+            id='exported_path',
+            title='Exported',
+            portal_type='Folder')
+    self.stepTic()
+
+    uid = self.portal.exported_path.getUid()
+
+    bt = self.portal.portal_templates.newContent(
+                          portal_type='Business Template',
+                          title='test_bt',
+                          template_path_list=(
+                            'exported_path',))
+    self.stepTic()
+    bt.build()
+    self.stepTic()
+    export_dir = tempfile.mkdtemp()
+    try:
+      bt.export(path=export_dir, local=True)
+      self.stepTic()
+      new_bt = self.portal.portal_templates.download(
+                        url='file:/%s' % export_dir)
+    finally:
+      shutil.rmtree(export_dir)
+    
+    # modify the document
+    self.portal.exported_path.setTitle('Modified')
+    self.stepTic()
+
+    # install the business template
+    new_bt.install()
+
+    # after installation, the exported document is replaced with the one from
+    # the business template
+    self.assertEquals('Exported', self.portal.exported_path.getTitle())
+    # but its uid did not change
+    self.assertEquals(uid, self.portal.exported_path.getUid())
+    # and it is still in the catalog
+    self.stepTic()
+    self.assertEquals(self.portal.exported_path,
+        self.portal.portal_catalog.getResultValue(uid=uid))
+
 
 def test_suite():
   suite = unittest.TestSuite()




More information about the Erp5-report mailing list