From d8b909b5bc40f6ff3aeb44af7d0bcc90c2e34a3c Mon Sep 17 00:00:00 2001
From: Nicolas Delaby <nicolas@nexedi.com>
Date: Wed, 6 Feb 2008 14:06:05 +0000
Subject: [PATCH] Duplicate Test to avoid modification on what it was tested
 before

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

diff --git a/product/ERP5Catalog/tests/testERP5Catalog.py b/product/ERP5Catalog/tests/testERP5Catalog.py
index 91f09386d0..8dace248a1 100644
--- a/product/ERP5Catalog/tests/testERP5Catalog.py
+++ b/product/ERP5Catalog/tests/testERP5Catalog.py
@@ -1620,7 +1620,6 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
     folder = self.getOrganisationModule()
     ob1 = folder.newContent(title='Object Title')
     ob1.manage_permission('View', ['Member'], 1)
-    ob1.manage_addLocalRoles('bob', ['Assignee'])
     ob2 = folder.newContent(title='Object Title')
     ob2.manage_addLocalRoles('bob', ['Assignee'])
     get_transaction().commit()
@@ -1664,6 +1663,24 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
                 ctool.countResults(title='Object Title',
                                    local_roles='Assignee;Auditor')[0][0])
 
+    #Test if bob can't see object even if Assignee role (without View permission) is defined on object
+    ob1.manage_addLocalRoles('bob', ['Assignee'])
+    get_transaction().commit()
+    self.tic()
+    ob1.immediateReindexObject()
+    self.assertEquals(1,
+                len(ctool.searchResults(title='Object Title',
+                                        local_roles='Assignee')))
+    self.assertEquals(1,
+                ctool.countResults(title='Object Title',
+                                   local_roles='Assignee')[0][0])
+
+    # this also work for searchFolder and countFolder
+    self.assertEquals(1, len(folder.searchFolder(title='Object Title',
+                                             local_roles='Assignee')))
+    self.assertEquals(1, folder.countFolder(title='Object Title',
+                                             local_roles='Assignee')[0][0])
+
   def test_51_SearchWithKeyWords(self, quiet=quiet, run=run_all_test):
     if not run: return
     if not quiet:
-- 
2.30.9