Commit 85547b1b authored by Łukasz Nowak's avatar Łukasz Nowak

- split to assert for roles on document and subdocuments acquiring local roles

Fix 35479 is not enough to refresh subdocuments


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35480 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a821b4dd
......@@ -676,14 +676,45 @@ class TestLocalRoleManagement(ERP5TypeTestCase):
uf._doAddUser(login, '', role_list, [])
def test_owner_local_role_on_clone(self):
# check that tested stuff is ok
parent_type = 'Person'
self.assertEquals(self.portal.portal_types[parent_type].acquire_local_roles, 0)
original_owner_id = 'original_user' + self.id()
cloning_owner_id = 'cloning_user' + self.id()
self._createZodbUser(original_owner_id)
self._createZodbUser(cloning_owner_id)
transaction.commit()
module = self.portal.getDefaultModule(portal_type=parent_type)
self.login(original_owner_id)
document = module.newContent(portal_type=parent_type)
self.stepTic()
self.login(cloning_owner_id)
cloned_document = document.Base_createCloneDocument(batch_mode=1)
self.stepTic()
self.login()
# real assertions
# roles on original document
self.assertEqual(
document.get_local_roles(),
(((original_owner_id), ('Owner',)),)
)
# roles on cloned document
self.assertEqual(
cloned_document.get_local_roles(),
(((cloning_owner_id), ('Owner',)),)
)
def test_owner_local_role_on_clone_with_subobjects(self):
# check that tested stuff is ok
parent_type = 'Person'
acquiring_type = 'Email'
self.assertEquals(self.portal.portal_types[acquiring_type].acquire_local_roles, 1)
self.assertEquals(self.portal.portal_types[parent_type].acquire_local_roles, 0)
original_owner_id = 'original_user'
cloning_owner_id = 'cloning_user'
original_owner_id = 'original_user' + self.id()
cloning_owner_id = 'cloning_user' + self.id()
self._createZodbUser(original_owner_id)
self._createZodbUser(cloning_owner_id)
transaction.commit()
......@@ -700,7 +731,7 @@ class TestLocalRoleManagement(ERP5TypeTestCase):
self.assertEqual(1, len(cloned_document.contentValues()))
cloned_subdocument = cloned_document.contentValues()[0]
# real assertions
# roles on original document
# roles on original documents
self.assertEqual(
document.get_local_roles(),
(((original_owner_id), ('Owner',)),)
......@@ -710,6 +741,7 @@ class TestLocalRoleManagement(ERP5TypeTestCase):
(((original_owner_id), ('Owner',)),)
)
# roles on cloned original documents
self.assertEqual(
cloned_document.get_local_roles(),
(((cloning_owner_id), ('Owner',)),)
......
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