From d72c173f8c06b4a8d92784f4639271c14d965d4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Mon, 25 Feb 2008 12:14:02 +0000 Subject: [PATCH] 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 --- product/ERP5Form/tests/testPreferences.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/product/ERP5Form/tests/testPreferences.py b/product/ERP5Form/tests/testPreferences.py index ac3e212dd5..89a6c6cc7d 100644 --- a/product/ERP5Form/tests/testPreferences.py +++ b/product/ERP5Form/tests/testPreferences.py @@ -397,7 +397,8 @@ class TestPreferences(ERP5TypeTestCase): def test_Permissions(self): # 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', priority=Priority.SITE) self.portal.portal_workflow.doActionFor(site_pref, 'enable_action') @@ -408,12 +409,16 @@ class TestPreferences(ERP5TypeTestCase): uf._doAddUser('member', '', ['Member', ], []) member = uf.getUserById('member').__of__(uf) newSecurityManager(None, member) - user_pref = self.portal.portal_preferences.newContent( - portal_type='Preference') + user_pref = preference_tool.newContent(portal_type='Preference') # Members can copy & paste existing preferences 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 self.assertTrue(member.has_permission('View', site_pref)) -- 2.30.9