Commit 671c0a34 authored by Łukasz Nowak's avatar Łukasz Nowak

- test fix: disable clearCache just before checking real issue


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40850 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4b53d5bf
...@@ -618,11 +618,41 @@ class TestPreferences(PropertySheetTestCase): ...@@ -618,11 +618,41 @@ class TestPreferences(PropertySheetTestCase):
portal_preferences.getDummystring()) portal_preferences.getDummystring())
def test_system_preference_value_prefererred_clear_cache_disabled(self): def test_system_preference_value_prefererred_clear_cache_disabled(self):
default_preference_string = 'Default Name'
normal_preference_string = 'Normal Preference'
system_preference_string = 'System Preference'
self._addPropertySheet('Preference', 'DummySystemPreference',
'''class DummySystemPreference:
_properties= ( {'id': 'dummystring',
'default': '%s',
'preference': True,
'type': 'string',},)''' % default_preference_string)
portal_preferences = self.portal.portal_preferences
self.assertEqual(default_preference_string,
portal_preferences.getDummystring())
preference = portal_preferences.newContent(portal_type='Preference',
dummystring=normal_preference_string,
priority=Priority.SITE)
preference.enable()
transaction.commit()
self.tic()
self.assertEqual(normal_preference_string,
portal_preferences.getDummystring())
# simulate situation when _clearCache does nothing, for example in case # simulate situation when _clearCache does nothing, for example in case
# if memcached or any other non-deleteable cache is used # if memcached or any other non-deleteable cache is used
from Products.ERP5Form.Document.Preference import Preference from Products.ERP5Form.Document.Preference import Preference
Preference._clearCache = lambda *args,**kwargs: None Preference._clearCache = lambda *args,**kwargs: None
self.test_system_preference_value_prefererred() system_preference = portal_preferences.newContent(portal_type='System Preference',
dummystring=system_preference_string)
system_preference.enable()
transaction.commit()
self.tic()
self.assertEqual(system_preference_string,
portal_preferences.getDummystring())
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
......
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