Commit b7587add authored by Łukasz Nowak's avatar Łukasz Nowak

- extend with testing getActivePreference result


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28289 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent bd8d83fb
...@@ -109,23 +109,32 @@ class TestPreferences(ERP5TypeTestCase): ...@@ -109,23 +109,32 @@ class TestPreferences(ERP5TypeTestCase):
group = self.getPreferenceTool()['group'] group = self.getPreferenceTool()['group']
site = self.getPreferenceTool()['site'] site = self.getPreferenceTool()['site']
self.assertEqual(None, self.getPreferenceTool().getActivePreference())
person1.portal_workflow.doActionFor( person1.portal_workflow.doActionFor(
person1, 'enable_action', wf_id='preference_workflow') person1, 'enable_action', wf_id='preference_workflow')
self.assertEquals(person1.getPreferenceState(), 'enabled') self.assertEquals(person1.getPreferenceState(), 'enabled')
self.assertEqual( person1, self.getPreferenceTool().getActivePreference())
portal_workflow.doActionFor( portal_workflow.doActionFor(
site, 'enable_action', wf_id='preference_workflow') site, 'enable_action', wf_id='preference_workflow')
self.assertEquals(person1.getPreferenceState(), 'enabled') self.assertEquals(person1.getPreferenceState(), 'enabled')
self.assertEquals(site.getPreferenceState(), 'global') self.assertEquals(site.getPreferenceState(), 'global')
self.assertEqual(person1, self.getPreferenceTool().getActivePreference())
portal_workflow.doActionFor( portal_workflow.doActionFor(
group, 'enable_action', wf_id='preference_workflow') group, 'enable_action', wf_id='preference_workflow')
self.assertEquals(person1.getPreferenceState(), 'enabled') self.assertEquals(person1.getPreferenceState(), 'enabled')
self.assertEquals(group.getPreferenceState(), 'enabled') self.assertEquals(group.getPreferenceState(), 'enabled')
self.assertEquals(site.getPreferenceState(), 'global') self.assertEquals(site.getPreferenceState(), 'global')
self.assertEqual(person1, self.getPreferenceTool().getActivePreference())
portal_workflow.doActionFor( portal_workflow.doActionFor(
person2, 'enable_action', wf_id='preference_workflow') person2, 'enable_action', wf_id='preference_workflow')
self.assertEqual(person2, self.getPreferenceTool().getActivePreference())
self.assertEquals(person2.getPreferenceState(), 'enabled') self.assertEquals(person2.getPreferenceState(), 'enabled')
# enabling a preference disable all other of the same level # enabling a preference disable all other of the same level
self.assertEquals(person1.getPreferenceState(), 'disabled') self.assertEquals(person1.getPreferenceState(), 'disabled')
......
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