From 25201f8ae7ff38b2ddc70959f23686bd5d8ce6e8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Wed, 17 Mar 2010 15:45:20 +0000
Subject: [PATCH] stop passing immediate_reindex=1 to newContent this API
 should not exist

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33809 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/tests/testAccounting.py         |  3 +--
 product/ERP5/tests/testInventoryAPI.py       | 19 ++++++++-----------
 product/ERP5/tests/testInvoiceVAT.py         |  3 +--
 product/ERP5/tests/testPredicate.py          |  5 +++--
 product/ERP5Catalog/tests/testERP5Catalog.py | 14 ++++++++------
 product/ERP5OOo/tests/testIngestion.py       |  1 -
 6 files changed, 21 insertions(+), 24 deletions(-)

diff --git a/product/ERP5/tests/testAccounting.py b/product/ERP5/tests/testAccounting.py
index fc43ac0f82..cf6834794d 100644
--- a/product/ERP5/tests/testAccounting.py
+++ b/product/ERP5/tests/testAccounting.py
@@ -2954,8 +2954,7 @@ class TestAccountingWithSequences(ERP5TypeTestCase):
         if not cat in path.objectIds():
           path = path.newContent(
             portal_type='Category',
-            id=cat,
-            immediate_reindex=1)
+            id=cat,)
         else:
           path = path[cat]
           
diff --git a/product/ERP5/tests/testInventoryAPI.py b/product/ERP5/tests/testInventoryAPI.py
index 05a296054f..f134e88da9 100644
--- a/product/ERP5/tests/testInventoryAPI.py
+++ b/product/ERP5/tests/testInventoryAPI.py
@@ -170,8 +170,7 @@ class InventoryAPITestCase(ERP5TypeTestCase):
         if not cat in path.objectIds() :
           path = path.newContent(
                     portal_type='Category',
-                    id=cat,
-                    immediate_reindex=1 )
+                    id=cat,)
         else:
           path = path[cat]
     # check categories have been created
@@ -179,6 +178,8 @@ class InventoryAPITestCase(ERP5TypeTestCase):
       self.assertNotEquals(None,
                 self.getCategoryTool().restrictedTraverse(cat_string),
                 cat_string)
+    transaction.commit()
+    self.tic()
                 
   def getNeededCategoryList(self):
     """return a list of categories that should be created."""
@@ -2319,8 +2320,7 @@ class BaseTestUnitConversion(InventoryAPITestCase):
         group = unit_module.newContent(
                  id=base,
                  portal_type='Quantity Unit Conversion Group',
-                 quantity_unit="%s/%s" % (base, standard),
-                 immediate_reindex=1 )
+                 quantity_unit="%s/%s" % (base, standard),)
       if group.getValidationState() in ('draft', 'invalidated'):
         group.validate()
 
@@ -2331,8 +2331,7 @@ class BaseTestUnitConversion(InventoryAPITestCase):
                         id=unit,
                         portal_type="Quantity Unit Conversion Definition",
                         quantity_unit="%s/%s" % (base, unit),
-                        quantity=amount,
-                        immediate_reindex=1)
+                        quantity=amount,)
         if definition.getValidationState() in ('draft', 'invalidated'):
           definition.validate()
 
@@ -2342,12 +2341,12 @@ class BaseTestUnitConversion(InventoryAPITestCase):
     self.setUpUnitDefinition()
     self._safeTic()
 
+  @reindex
   def makeMovement(self, quantity, resource, *variation, **kw):
     m = self._makeMovement(quantity=quantity, resource_value=resource,
       source_value=self.node, destination_value=self.mirror_node, **kw)
     if variation:
       m.setVariationCategoryList(variation)
-      self._safeTic()
 
   def convertedSimulation(self, metric_type, **kw):
     return self.getSimulationTool().getInventory(
@@ -2500,16 +2499,14 @@ class TestUnitConversionDefinition(BaseTestUnitConversion):
 
     base_unit = self.resource_bylot_overriding.newContent(
                   portal_type='Quantity Unit Conversion Group',
-                  quantity_unit='unit/unit',
-                  immediate_reindex=1)
+                  quantity_unit='unit/unit',)
     base_unit.validate()
 
 
     unit = base_unit.newContent(
             portal_type='Quantity Unit Conversion Definition',
             quantity_unit='unit/lot',
-            quantity=50,
-            immediate_reindex=1)
+            quantity=50,)
     unit.validate()
 
     self._safeTic()
diff --git a/product/ERP5/tests/testInvoiceVAT.py b/product/ERP5/tests/testInvoiceVAT.py
index c065d9ac95..047f95bb32 100644
--- a/product/ERP5/tests/testInvoiceVAT.py
+++ b/product/ERP5/tests/testInvoiceVAT.py
@@ -113,8 +113,7 @@ class TestInvoiceVAT(ERP5TypeTestCase):
         if not cat in path.objectIds() :
           path = path.newContent(
                     portal_type='Category',
-                    id=cat,
-                    immediate_reindex=1 )
+                    id=cat,)
         else:
           path = path[cat]
     # check categories have been created
diff --git a/product/ERP5/tests/testPredicate.py b/product/ERP5/tests/testPredicate.py
index 4625d72b03..3f23e9a152 100644
--- a/product/ERP5/tests/testPredicate.py
+++ b/product/ERP5/tests/testPredicate.py
@@ -84,8 +84,7 @@ class TestPredicateMixIn(ERP5TypeTestCase):
         if not cat in path.objectIds() :
           path = path.newContent(
             portal_type = 'Category',
-            id = cat,
-            immediate_reindex = 1 )
+            id = cat,)
         else :
           path = path[cat]
 
@@ -94,6 +93,8 @@ class TestPredicateMixIn(ERP5TypeTestCase):
       self.assertNotEquals(None,
                 self.getCategoryTool().restrictedTraverse(cat_string),
                 cat_string)
+    transaction.commit()
+    self.tic()
 
   def getNeededCategoryList(self):
     """return a list of categories that should be created."""
diff --git a/product/ERP5Catalog/tests/testERP5Catalog.py b/product/ERP5Catalog/tests/testERP5Catalog.py
index 3a997bc2cb..7360410b73 100644
--- a/product/ERP5Catalog/tests/testERP5Catalog.py
+++ b/product/ERP5Catalog/tests/testERP5Catalog.py
@@ -195,8 +195,8 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
     self.checkRelativeUrlNotInSQLPathList(path_list)
     # Now we will ask to immediatly reindex
     person = person_module.newContent(id='2',
-                                      portal_type='Person',
-                                      immediate_reindex=1)
+                                      portal_type='Person',)
+    person.immediateReindexObject()
     path_list = [person.getRelativeUrl()]
     self.checkRelativeUrlInSQLPathList(path_list)
     person.immediateReindexObject()
@@ -228,7 +228,8 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
     # Now we will try the same thing as previous test and look at searchFolder
     folder_object_list = [x.getObject().getId() for x in person_module.searchFolder()]
     self.assertEquals([],folder_object_list)
-    person = person_module.newContent(id='4',portal_type='Person',immediate_reindex=1)
+    person = person_module.newContent(id='4',portal_type='Person',)
+    person.immediateReindexObject()
     folder_object_list = [x.getObject().getId() for x in person_module.searchFolder()]
     self.assertEquals(['4'],folder_object_list)
     person.immediateReindexObject()
@@ -300,7 +301,8 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
     portal_catalog = self.getCatalogTool()
     portal_catalog.manage_catalogClear()
 
-    person = person_module.newContent(id='4',portal_type='Person',immediate_reindex=1)
+    person = person_module.newContent(id='4',portal_type='Person')
+    person.immediateReindexObject()
     folder_object_list = [x.getObject().getId() for x in person_module.searchFolder()]
     self.assertEquals(['4'],folder_object_list)
 
@@ -910,8 +912,8 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
     person_module = self.getPersonModule()
     # Now we will ask to immediatly reindex
     person = person_module.newContent(id='2',
-                                      portal_type='Person',
-                                      immediate_reindex=1)
+                                      portal_type='Person',)
+    person.immediateReindexObject()
     path_list = [person.getRelativeUrl()]
     self.checkRelativeUrlInSQLPathList(path_list)
     # We will delete the connector
diff --git a/product/ERP5OOo/tests/testIngestion.py b/product/ERP5OOo/tests/testIngestion.py
index 297fe3872c..2b66b14485 100644
--- a/product/ERP5OOo/tests/testIngestion.py
+++ b/product/ERP5OOo/tests/testIngestion.py
@@ -206,7 +206,6 @@ class TestIngestion(ERP5TypeTestCase):
               category_type = 'Category'
             base_path_obj.newContent( portal_type       = category_type
                                     , id                = category_id
-                                    , immediate_reindex = 1
                                     )
           base_path_obj = base_path_obj[category_id]
           is_base_category = False
-- 
2.30.9