Commit 3746e80b authored by Jérome Perrin's avatar Jérome Perrin

tests that permissions are set correctly on preferences / preference tool


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19479 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 503af257
...@@ -395,6 +395,34 @@ class TestPreferences(ERP5TypeTestCase): ...@@ -395,6 +395,34 @@ class TestPreferences(ERP5TypeTestCase):
state_list = method(('default',)) state_list = method(('default',))
self.assertEquals(state_list, ('default',)) self.assertEquals(state_list, ('default',))
def test_Permissions(self):
# create a new site preference for later
site_pref = self.portal.portal_preferences.newContent(
portal_type='Preference',
priority=Priority.SITE)
self.portal.portal_workflow.doActionFor(site_pref, 'enable_action')
self.assertEquals(site_pref.getPreferenceState(), 'global')
# Members can add new preferences
uf = self.getPortal().acl_users
uf._doAddUser('member', '', ['Member', ], [])
member = uf.getUserById('member').__of__(uf)
newSecurityManager(None, member)
user_pref = self.portal.portal_preferences.newContent(
portal_type='Preference')
# Members can copy & paste existing preferences
user_pref.Base_createCloneDocument()
# Globally enabled preferences can be viewed by Members
self.assertTrue(member.has_permission('View', site_pref))
# Member does not have Manage properties on their own preferences,
# otherwise the "Metadata" tab is shown
self.assertFalse(member.has_permission(
'Manage properties', user_pref))
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestPreferences)) suite.addTest(unittest.makeSuite(TestPreferences))
......
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