From b3bd7b41d7eb40c767d8c2f9b502cf8ee8a6f940 Mon Sep 17 00:00:00 2001
From: Yusei Tahara <yusei@nexedi.com>
Date: Thu, 15 Nov 2007 16:26:15 +0000
Subject: [PATCH] Follow the purpose of test_22_securityReindex, set
 Person.acquire_local_role True for the test.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17637 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Type/tests/testERP5Type.py | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/product/ERP5Type/tests/testERP5Type.py b/product/ERP5Type/tests/testERP5Type.py
index ed4182a723..232327f034 100644
--- a/product/ERP5Type/tests/testERP5Type.py
+++ b/product/ERP5Type/tests/testERP5Type.py
@@ -136,12 +136,25 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor):
       # filter content types to add inside Person.
       self.getTypesTool().getTypeInfo('Person').filter_content_types = 0
 
+      # turn on Person.acquire_local_roles only for test_22_securityReindex.
+      if str(self).startswith('test_22_securityReindex'):
+        person = self.getTypesTool().getTypeInfo('Person')
+        self.person_acquire_local_roles = person.acquire_local_roles
+        person.acquire_local_roles = True
+        self.portal.portal_caches.clearAllCache()
+
     def beforeTearDown(self):
       get_transaction().abort()
       for module in [ self.getPersonModule(),
                       self.getOrganisationModule(),
                       self.getCategoryTool().region ]:
         module.manage_delObjects(list(module.objectIds()))
+
+      # turn off Person.acquire_local_roles only for test_22_securityReindex.
+      if str(self).startswith('test_22_securityReindex'):
+        self.getTypesTool().getTypeInfo('Person').acquire_local_roles = self.person_acquire_local_roles
+        self.portal.portal_caches.clearAllCache()
+
       get_transaction().commit()
       self.tic()
 
@@ -1167,7 +1180,9 @@ class TestPropertySheet:
 
     def test_22_securityReindex(self, quiet=quiet, run=run_all_test):
       """
-      Tests that the security is reindexed when a role is changed on an object
+      Tests that the security is reindexed when a role is changed on an object.
+      
+      Note: Turn on Person.acquire_local_roles to 0 in afterSetUp.
       """
       if not run: return
       from AccessControl import getSecurityManager
-- 
2.30.9