Commit 17384cb5 authored by Gabriel Monnerat's avatar Gabriel Monnerat

refactor test because part of this test was moved erp5_web_ung_theme

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@44220 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2874c0ca
...@@ -75,6 +75,8 @@ class TestUNGSecurity(ERP5TypeTestCase): ...@@ -75,6 +75,8 @@ class TestUNGSecurity(ERP5TypeTestCase):
self.stepTic() self.stepTic()
def afterSetUp(self): def afterSetUp(self):
if self.portal.portal_preferences.ung_preference.getPreferenceState() != "global":
self.portal.portal_preferences.ung_preference.enable()
person = self.portal.person_module.newContent(portal_type='Person', person = self.portal.person_module.newContent(portal_type='Person',
reference="ung_user") reference="ung_user")
assignment = person.newContent(portal_type='Assignment') assignment = person.newContent(portal_type='Assignment')
...@@ -92,7 +94,6 @@ class TestUNGSecurity(ERP5TypeTestCase): ...@@ -92,7 +94,6 @@ class TestUNGSecurity(ERP5TypeTestCase):
def testERP5Site_createNewWebDocumentWithUNGRole(self): def testERP5Site_createNewWebDocumentWithUNGRole(self):
"""Test use script ERP5Site_createNewWebDocument when a erp5 user have role """Test use script ERP5Site_createNewWebDocument when a erp5 user have role
to create and edit document in UNG""" to create and edit document in UNG"""
self.portal.portal_preferences.ung_preference.enable()
self.login("ung_user") self.login("ung_user")
web_page = self.portal.portal_catalog.getResultValue(portal_type="Web Page") web_page = self.portal.portal_catalog.getResultValue(portal_type="Web Page")
self.assertEquals(web_page, None) self.assertEquals(web_page, None)
...@@ -182,9 +183,16 @@ class TestUNGSecurity(ERP5TypeTestCase): ...@@ -182,9 +183,16 @@ class TestUNGSecurity(ERP5TypeTestCase):
self.assertEquals(person.getValidationState(), "validated") self.assertEquals(person.getValidationState(), "validated")
def testBase_getPreferencePathList(self): def testBase_getPreferencePathList(self):
"""Test if with a normal user the paths of preference objects are returned correctly""" """Test if with normal user the paths of preference objects are returned correctly"""
self.logout() person = self.portal.person_module.newContent(portal_type='Person',
self.assertEquals(json.loads(self.portal.Base_getPreferencePathList()), None) reference="ung_user2")
assignment = person.newContent(portal_type='Assignment')
assignment.setFunction("function/ung_user")
assignment.open()
self.stepTic()
self.login("ung_user") self.login("ung_user")
preference_dict = json.loads(self.portal.Base_getPreferencePathList()) preference_dict = json.loads(self.portal.Base_getPreferencePathList())
self.assertEquals(preference_dict["preference"], "portal_preferences/1") self.assertEquals(preference_dict, {u'preference': u'portal_preferences/1'})
self.login("ung_user2")
preference_dict = json.loads(self.portal.Base_getPreferencePathList())
self.assertEquals(preference_dict, {u'preference': u'portal_preferences/2'})
\ No newline at end of file
23 24
\ No newline at end of file \ No newline at end of file
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