From 8cc180ab6313c9af7fa88dd9f9e963d6284fe642 Mon Sep 17 00:00:00 2001
From: Sebastien Robin <seb@nexedi.com>
Date: Tue, 20 Mar 2007 22:07:08 +0000
Subject: [PATCH] try to delete object when we are doing hot reindexing and
 when we are in the double indexing state

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13530 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Catalog/tests/testERP5Catalog.py | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/product/ERP5Catalog/tests/testERP5Catalog.py b/product/ERP5Catalog/tests/testERP5Catalog.py
index 170feb34e5..413e59513d 100644
--- a/product/ERP5Catalog/tests/testERP5Catalog.py
+++ b/product/ERP5Catalog/tests/testERP5Catalog.py
@@ -1413,6 +1413,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
     module = portal.getDefaultModule('Organisation')
     self.organisation2 = module.newContent(portal_type='Organisation',
                                      title="GreatTitle2")
+    first_deleted_url = self.organisation2.getRelativeUrl()
     get_transaction().commit()
     self.tic()
     path_list = [self.organisation.getRelativeUrl()]
@@ -1453,6 +1454,11 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
                          'InventoryModule_reindexMovementList',
                          'immediateReindexObject',
                          'Folder_reindexObjectList',
+                         'unindexObject',
+                         'recursiveImmediateReindexObject'))
+    # try to delete objects in double indexing state
+    module.manage_delObjects(ids=[self.organisation2.getId()])
+    self.playActivityList(('immediateReindexObject',
                          'unindexObject',
                          'recursiveImmediateReindexObject',
                          'playBackRecordedObjectList',
@@ -1473,10 +1479,12 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
     module.manage_delObjects(ids=[self.next_deleted_organisation.getId()])
     get_transaction().commit()
     self.tic()
+    self.assertEquals(portal_catalog.getHotReindexingState(),
+                      HOT_REINDEXING_FINISHED_STATE)
     path_list = [self.organisation3.getRelativeUrl()]
     self.checkRelativeUrlInSQLPathList(path_list,connection_id=self.new_connection_id)
     self.checkRelativeUrlInSQLPathList(path_list,connection_id=self.original_connection_id)
-    path_list = [deleted_url,next_deleted_url]
+    path_list = [first_deleted_url,deleted_url,next_deleted_url]
     self.checkRelativeUrlNotInSQLPathList(path_list,connection_id=self.new_connection_id)
     self.checkRelativeUrlNotInSQLPathList(path_list,connection_id=self.original_connection_id)
     
@@ -1646,3 +1654,13 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
     self.assertEquals([select_], [x.getObject() for x in
                                    ctool(portal_type='Person', title='SELECT')])
 
+
+if __name__ == '__main__':
+    framework()
+else:
+    import unittest
+    def test_suite():
+        suite = unittest.TestSuite()
+        suite.addTest(unittest.makeSuite(TestERP5Catalog))
+        return suite
+
-- 
2.30.9