Commit b5f3dd74 authored by Vincent Pelletier's avatar Vincent Pelletier

Add a check that a single object is not counted twice when it matched 2...

Add a check that a single object is not counted twice when it matched 2 different security criterions (owner role as a catalog table column and security_uid).


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17092 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c29dacb1
...@@ -48,6 +48,8 @@ class TestWorklist(ERP5TypeTestCase): ...@@ -48,6 +48,8 @@ class TestWorklist(ERP5TypeTestCase):
actbox_assignor_name = 'assignor_todo' actbox_assignor_name = 'assignor_todo'
worklist_owner_id = 'owner_worklist' worklist_owner_id = 'owner_worklist'
actbox_owner_name = 'owner_todo' actbox_owner_name = 'owner_todo'
worklist_assignor_owner_id = 'assignor_owner_worklist'
actbox_assignor_owner_name = 'assignor_owner_todo'
def getTitle(self): def getTitle(self):
return "Worklist" return "Worklist"
...@@ -140,7 +142,8 @@ class TestWorklist(ERP5TypeTestCase): ...@@ -140,7 +142,8 @@ class TestWorklist(ERP5TypeTestCase):
for worklist_id, actbox_name, role in [ for worklist_id, actbox_name, role in [
(self.worklist_assignor_id, self.actbox_assignor_name, 'Assignor'), (self.worklist_assignor_id, self.actbox_assignor_name, 'Assignor'),
(self.worklist_owner_id, self.actbox_owner_name, 'Owner')]: (self.worklist_owner_id, self.actbox_owner_name, 'Owner'),
(self.worklist_assignor_owner_id, self.actbox_assignor_owner_name, 'Assignor; Owner')]:
worklists.addWorklist(worklist_id) worklists.addWorklist(worklist_id)
worklist_definition = worklists._getOb(worklist_id) worklist_definition = worklists._getOb(worklist_id)
worklist_definition.setProperties('', worklist_definition.setProperties('',
...@@ -198,6 +201,8 @@ class TestWorklist(ERP5TypeTestCase): ...@@ -198,6 +201,8 @@ class TestWorklist(ERP5TypeTestCase):
self.login('manager') self.login('manager')
self.logMessage("Give foo Assignor role") self.logMessage("Give foo Assignor role")
document.manage_addLocalRoles('foo', ['Assignor']) document.manage_addLocalRoles('foo', ['Assignor'])
self.logMessage("Give manager Assignor role")
document.manage_addLocalRoles('manager', ['Assignor'])
document.reindexObject() document.reindexObject()
get_transaction().commit() get_transaction().commit()
self.tic() self.tic()
...@@ -210,11 +215,19 @@ class TestWorklist(ERP5TypeTestCase): ...@@ -210,11 +215,19 @@ class TestWorklist(ERP5TypeTestCase):
self.logMessage("Check %s worklist as Assignor" % user_id) self.logMessage("Check %s worklist as Assignor" % user_id)
entry_list = [x for x in result \ entry_list = [x for x in result \
if x['name'].startswith(self.actbox_assignor_name)] if x['name'].startswith(self.actbox_assignor_name)]
self.assertEquals(len(entry_list), 0) self.assertEquals(len(entry_list), 1)
self.assertEquals(
self.getWorklistDocumentCountFromActionName(entry_list[0]['name']), 1)
self.logMessage("Check %s worklist as Owner" % user_id) self.logMessage("Check %s worklist as Owner" % user_id)
entry_list = [x for x in result \ entry_list = [x for x in result \
if x['name'].startswith(self.actbox_owner_name)] if x['name'].startswith(self.actbox_owner_name)]
self.assertEquals(len(entry_list), 1) self.assertEquals(len(entry_list), 1)
self.assertEquals(
self.getWorklistDocumentCountFromActionName(entry_list[0]['name']), 1)
self.logMessage("Check %s worklist as Owner and Assignor" % user_id)
entry_list = [x for x in result \
if x['name'].startswith(self.actbox_assignor_owner_name)]
self.assertEquals(len(entry_list), 1)
self.assertEquals( self.assertEquals(
self.getWorklistDocumentCountFromActionName(entry_list[0]['name']), 1) self.getWorklistDocumentCountFromActionName(entry_list[0]['name']), 1)
self.logout() self.logout()
...@@ -264,7 +277,9 @@ class TestWorklist(ERP5TypeTestCase): ...@@ -264,7 +277,9 @@ class TestWorklist(ERP5TypeTestCase):
self.logMessage("Check %s worklist as Assignor" % user_id) self.logMessage("Check %s worklist as Assignor" % user_id)
entry_list = [x for x in result \ entry_list = [x for x in result \
if x['name'].startswith(self.actbox_assignor_name)] if x['name'].startswith(self.actbox_assignor_name)]
self.assertEquals(len(entry_list), 0) self.assertEquals(len(entry_list), 1)
self.assertTrue(
self.getWorklistDocumentCountFromActionName(entry_list[0]['name']), 1)
self.logMessage("Check %s worklist as Owner" % user_id) self.logMessage("Check %s worklist as Owner" % user_id)
entry_list = [x for x in result \ entry_list = [x for x in result \
if x['name'].startswith(self.actbox_owner_name)] if x['name'].startswith(self.actbox_owner_name)]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment