Commit 14f26ca0 authored by Nicolas Dumazet's avatar Nicolas Dumazet

Fix descendants of PropertySheetTestCase:

* use beforeTearDown instead of tearDown
* pay attention to abort() ordering so that no parent or
  subclass calls can invalidate necessary changes from tearDown logic
* use unique names for property sheets to get independant fixtures.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43099 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 59359459
...@@ -58,10 +58,10 @@ class TestPreferences(PropertySheetTestCase): ...@@ -58,10 +58,10 @@ class TestPreferences(PropertySheetTestCase):
self.createPreferences() self.createPreferences()
def beforeTearDown(self): def beforeTearDown(self):
transaction.abort()
portal_preferences = self.getPreferenceTool() portal_preferences = self.getPreferenceTool()
portal_preferences.manage_delObjects(list(portal_preferences.objectIds())) portal_preferences.manage_delObjects(list(portal_preferences.objectIds()))
transaction.commit() super(TestPreferences, self).beforeTearDown()
self.tic()
def createPreferences(self): def createPreferences(self):
""" create some preferences objects """ """ create some preferences objects """
...@@ -560,7 +560,8 @@ class TestPreferences(PropertySheetTestCase): ...@@ -560,7 +560,8 @@ class TestPreferences(PropertySheetTestCase):
self.assertEqual(system_pref, preference_tool.getActiveSystemPreference()) self.assertEqual(system_pref, preference_tool.getActiveSystemPreference())
def test_boolean_accessor(self): def test_boolean_accessor(self):
self._addProperty('Preference', 'DummyPreference', self._addProperty('Preference',
'test_boolean_accessor Preference',
portal_type='Standard Property', portal_type='Standard Property',
property_id='dummy', property_id='dummy',
preference=True, preference=True,
...@@ -584,7 +585,8 @@ class TestPreferences(PropertySheetTestCase): ...@@ -584,7 +585,8 @@ class TestPreferences(PropertySheetTestCase):
write_permission = 'Modify portal content' write_permission = 'Modify portal content'
read_permission = 'Manage portal' read_permission = 'Manage portal'
self._addProperty('Preference', 'DummyPreference', self._addProperty('Preference',
'test_property_sheet_security_on_permission Preference',
property_id='preferred_toto', property_id='preferred_toto',
portal_type='Standard Property', portal_type='Standard Property',
preference=1, preference=1,
...@@ -633,7 +635,8 @@ class TestPreferences(PropertySheetTestCase): ...@@ -633,7 +635,8 @@ class TestPreferences(PropertySheetTestCase):
default_preference_string = 'Default Name' default_preference_string = 'Default Name'
normal_preference_string = 'Normal Preference' normal_preference_string = 'Normal Preference'
system_preference_string = 'System Preference' system_preference_string = 'System Preference'
self._addProperty('Preference', 'DummySystemPreference', self._addProperty('Preference',
'test_system_preference_value_prefererred Preference',
portal_type='Standard Property', portal_type='Standard Property',
property_id='dummystring', property_id='dummystring',
property_default='python: "%s"' % default_preference_string, property_default='python: "%s"' % default_preference_string,
...@@ -667,7 +670,8 @@ class TestPreferences(PropertySheetTestCase): ...@@ -667,7 +670,8 @@ class TestPreferences(PropertySheetTestCase):
default_preference_string = 'Default Name' default_preference_string = 'Default Name'
normal_preference_string = 'Normal Preference' normal_preference_string = 'Normal Preference'
system_preference_string = 'System Preference' system_preference_string = 'System Preference'
self._addProperty('Preference', 'DummySystemPreference', self._addProperty('Preference',
'test_system_preference_value_prefererred_clear_cache_disabled Preference',
portal_type='Standard Property', portal_type='Standard Property',
property_id='dummystring', property_id='dummystring',
property_default='python: "%s"' % default_preference_string, property_default='python: "%s"' % default_preference_string,
......
...@@ -72,8 +72,7 @@ class TestConstraint(PropertySheetTestCase): ...@@ -72,8 +72,7 @@ class TestConstraint(PropertySheetTestCase):
transaction.abort() transaction.abort()
module = self.portal.organisation_module module = self.portal.organisation_module
module.manage_delObjects(list(module.objectIds())) module.manage_delObjects(list(module.objectIds()))
transaction.commit() super(TestConstraint, self).beforeTearDown()
self.tic()
def createCategories(self): def createCategories(self):
""" """
......
This diff is collapsed.
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