Commit d72c173f authored by Jérome Perrin's avatar Jérome Perrin

make sure that if we copy & paste a Site preference, it will be a User

preference


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19486 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 715a95e9
...@@ -397,7 +397,8 @@ class TestPreferences(ERP5TypeTestCase): ...@@ -397,7 +397,8 @@ class TestPreferences(ERP5TypeTestCase):
def test_Permissions(self): def test_Permissions(self):
# create a new site preference for later # create a new site preference for later
site_pref = self.portal.portal_preferences.newContent( preference_tool = self.portal.portal_preferences
site_pref = preference_tool.newContent(
portal_type='Preference', portal_type='Preference',
priority=Priority.SITE) priority=Priority.SITE)
self.portal.portal_workflow.doActionFor(site_pref, 'enable_action') self.portal.portal_workflow.doActionFor(site_pref, 'enable_action')
...@@ -408,11 +409,15 @@ class TestPreferences(ERP5TypeTestCase): ...@@ -408,11 +409,15 @@ class TestPreferences(ERP5TypeTestCase):
uf._doAddUser('member', '', ['Member', ], []) uf._doAddUser('member', '', ['Member', ], [])
member = uf.getUserById('member').__of__(uf) member = uf.getUserById('member').__of__(uf)
newSecurityManager(None, member) newSecurityManager(None, member)
user_pref = self.portal.portal_preferences.newContent( user_pref = preference_tool.newContent(portal_type='Preference')
portal_type='Preference')
# Members can copy & paste existing preferences # Members can copy & paste existing preferences
user_pref.Base_createCloneDocument() user_pref.Base_createCloneDocument()
# note that copy & pasting a site preference reset the priority to USER
# preference.
cp_data = preference_tool.manage_copyObjects(ids=[site_pref.getId()])
copy_id = preference_tool.manage_pasteObjects(cp_data)[0]['new_id']
self.assertEquals(Priority.USER, preference_tool[copy_id].getPriority())
# Globally enabled preferences can be viewed by Members # Globally enabled preferences can be viewed by Members
self.assertTrue(member.has_permission('View', site_pref)) self.assertTrue(member.has_permission('View', site_pref))
......
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