Commit d3891726 authored by Aurel's avatar Aurel

add test for permissions on module


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7616 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent eb39e5bd
......@@ -352,6 +352,8 @@ class TestBusinessTemplate(ERP5TypeTestCase):
id = "%s_%s" %('geek_module', n)
module = portal.newContent(id=id, portal_type='Geek Module')
self.failUnless(module is not None)
# add a specific permission to module which do not use acquisition
module.manage_permission('Copy or Move', ['Assignor'], False)
sequence.edit(module_id=module.getId())
module_object_list = []
for i in xrange(10):
......@@ -402,6 +404,27 @@ class TestBusinessTemplate(ERP5TypeTestCase):
new_module = portal._getOb(module_id, None)
self.failIf(new_module is None)
def stepCheckModulePermissions(self, sequence=None, sequence_list=None, **kw):
"""
Check specific permissions defined on module do no get acquired flag
"""
portal = self.getPortal()
module_id = sequence.get("module_id")
new_module = portal._getOb(module_id, None)
perms = new_module.permission_settings('Copy or Move')
self.assertEqual(len(perms), 1)
# check we do not have acquire
for perm in perms:
self.assertEqual(perm['name'], 'Copy or Move')
self.assertNotEqual(perm['acquire'], 'CHECKED')
# check permission defined for the right role
perms = new_module.rolesOfPermission(permission='Copy or Move')
for perm in perms:
if perm['name'] == 'Assignor':
self.assertEqual(perm["selected"], "SELECTED")
else:
self.assertNotEqual(perm["selected"], "SELECTED")
def stepCheckModuleObjectsExists(self, sequence=None, sequence_list=None, **kw):
"""
Check presence of objects in module
......@@ -1661,7 +1684,7 @@ class TestBusinessTemplate(ERP5TypeTestCase):
sequence_list.play(self)
# test of module
def test_05_BusinessTemplateWithModule(self, quiet=0, run=run_all_test):
def test_05_BusinessTemplateWithModule(self, quiet=0, run_all_test):
if not run: return
if not quiet:
message = 'Test Business Template With Module'
......@@ -1701,6 +1724,7 @@ class TestBusinessTemplate(ERP5TypeTestCase):
CheckSkinsLayers \
CheckPortalTypeExists \
CheckModuleExists \
CheckModulePermissions \
CheckModuleObjectsRemoved \
UninstallBusinessTemplate \
CheckBuiltBuildingState \
......
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