From 529650a8a0cb3226515a4a9de97e2c6e2f6bd6c1 Mon Sep 17 00:00:00 2001 From: Nicolas Delaby <nicolas@nexedi.com> Date: Wed, 6 Feb 2008 15:31:16 +0000 Subject: [PATCH] Avoid Clear Activities in tearDown, Perform test git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19105 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Catalog/tests/testERP5Catalog.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/product/ERP5Catalog/tests/testERP5Catalog.py b/product/ERP5Catalog/tests/testERP5Catalog.py index 8dace248a1..d6efb55dea 100644 --- a/product/ERP5Catalog/tests/testERP5Catalog.py +++ b/product/ERP5Catalog/tests/testERP5Catalog.py @@ -76,8 +76,8 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): self.getCategoryTool().region, self.getCategoryTool().group ]: module.manage_delObjects(list(module.objectIds())) - self.getPortal().portal_activities.manageClearActivities() get_transaction().commit() + self.tic() def login(self): uf = self.getPortal().acl_users @@ -1621,6 +1621,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): ob1 = folder.newContent(title='Object Title') ob1.manage_permission('View', ['Member'], 1) ob2 = folder.newContent(title='Object Title') + ob2_id = ob2.getId() ob2.manage_addLocalRoles('bob', ['Assignee']) get_transaction().commit() self.tic() @@ -1665,12 +1666,17 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): #Test if bob can't see object even if Assignee role (without View permission) is defined on object ob1.manage_addLocalRoles('bob', ['Assignee']) + ob1.manage_permission('View', ['Assignor'], 0) + ob1.reindexObject() get_transaction().commit() self.tic() - ob1.immediateReindexObject() - self.assertEquals(1, - len(ctool.searchResults(title='Object Title', - local_roles='Assignee'))) + from AccessControl import getSecurityManager + user = getSecurityManager().getUser() + self.assertFalse(user.has_permission('View', ob1)) + self.assertTrue(user.has_role('Assignee', ob1)) + result_list = [r.getId() for r in ctool(title='Object Title', local_roles='Assignee')] + self.assertEquals(1, len(result_list)) + self.assertEquals([ob2_id], result_list) self.assertEquals(1, ctool.countResults(title='Object Title', local_roles='Assignee')[0][0]) -- 2.30.9