Commit 8670c907 authored by Jérome Perrin's avatar Jérome Perrin

Commit ZODB transaction explicitly, because PreferenceTool use ZSQLCatalog to find preferences.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5006 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 94902bb2
......@@ -58,12 +58,14 @@ class TestPreferences(ERP5TypeTestCase):
uf._doAddUser('manager', '', ['Manager', 'Owner', 'Assignor'], [])
user = uf.getUserById('manager').__of__(uf)
newSecurityManager(None, user)
if getattr(self.getPreferenceTool(), 'person1', None) is None :
self.createPreferences()
def createPreferences(self) :
""" create some preferences objects """
portal_preferences = self.getPreferenceTool()
if getattr(portal_preferences, 'person1', None) is not None :
portal_preferences.manage_delObjects([
'person1', 'person2', 'group', 'site'])
## create initial preferences
person1 = portal_preferences.newContent(
id='person1', portal_type='Preference')
......@@ -75,7 +77,12 @@ class TestPreferences(ERP5TypeTestCase):
site = portal_preferences.newContent(
id='site', portal_type='Preference')
site.setPriority(Priority.SITE)
# commit transaction
get_transaction().commit()
self.getPreferenceTool().recursiveReindexObject()
self.tic()
# check preference levels are Ok
self.assertEquals(person1.getPriority(), Priority.USER)
self.assertEquals(person2.getPriority(), Priority.USER)
......@@ -87,6 +94,7 @@ class TestPreferences(ERP5TypeTestCase):
self.assertEquals(group.getPreferenceState(), 'disabled')
self.assertEquals(site.getPreferenceState(), 'disabled')
def test_EnablePreferences(self, quiet=quiet, run=run_all_tests) :
""" tests preference workflow """
if not run: return
......@@ -114,8 +122,6 @@ class TestPreferences(ERP5TypeTestCase):
self.assertEquals(group.getPreferenceState(), 'enabled')
self.assertEquals(site.getPreferenceState(), 'enabled')
self.getPreferenceTool().recursiveImmediateReindexObject()
portal_workflow.doActionFor(
person2, 'enable_action', wf_id='preference_workflow')
self.assertEquals(person2.getPreferenceState(), 'enabled')
......
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