Commit 358c5845 authored by Nicolas Dumazet's avatar Nicolas Dumazet

convert this test to ZODB property sheets

It means that we cant access the Legacy module anymore,
so for now we hardcode this default_large_image_height value


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42897 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b694e729
...@@ -41,11 +41,9 @@ from Products.ERP5Type.tests.backportUnittest import expectedFailure ...@@ -41,11 +41,9 @@ from Products.ERP5Type.tests.backportUnittest import expectedFailure
from Products.ERP5Type.tests.testERP5Type import PropertySheetTestCase from Products.ERP5Type.tests.testERP5Type import PropertySheetTestCase
from Products.ERP5Type.tests.utils import createZODBPythonScript from Products.ERP5Type.tests.utils import createZODBPythonScript
from Products.ERP5Form.PreferenceTool import Priority from Products.ERP5Form.PreferenceTool import Priority
from Products.ERP5PropertySheetLegacy.PropertySheet.HtmlStylePreference import HtmlStylePreference
default_large_image_height, = [pref.get('default') # should match what's configured by default in HtmlStylePreference
for pref in HtmlStylePreference._properties default_large_image_height = 768
if pref['id'] == 'preferred_large_image_height']
class TestPreferences(PropertySheetTestCase): class TestPreferences(PropertySheetTestCase):
...@@ -562,11 +560,11 @@ class TestPreferences(PropertySheetTestCase): ...@@ -562,11 +560,11 @@ 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._addPropertySheet('Preference', 'DummyPreference', self._addProperty('Preference', 'DummyPreference',
'''class DummyPreference: portal_type='Standard Property',
_properties= ( {'id': 'dummy', property_id='dummy',
'preference': True, preference=True,
'type': 'boolean',},)''') elementary_type='boolean')
portal_preferences = self.portal.portal_preferences portal_preferences = self.portal.portal_preferences
self.assertFalse(portal_preferences.getDummy()) self.assertFalse(portal_preferences.getDummy())
self.assertFalse(portal_preferences.isDummy()) self.assertFalse(portal_preferences.isDummy())
...@@ -585,13 +583,14 @@ class TestPreferences(PropertySheetTestCase): ...@@ -585,13 +583,14 @@ class TestPreferences(PropertySheetTestCase):
preference level. """ preference level. """
write_permission = 'Modify portal content' write_permission = 'Modify portal content'
read_permission = 'Manage portal' read_permission = 'Manage portal'
self._addPropertySheet('Preference', 'DummyPreference',
'''class DummyPreference: self._addProperty('Preference', 'DummyPreference',
_properties= ( {'id': 'preferred_toto', property_id='preferred_toto',
'write_permission' : 'Modify portal content', portal_type='Standard Property',
'read_permission' : 'Manage portal', preference=1,
'preference': 1, write_permission='Modify portal content',
'type': 'string',},)''') read_permission='Manage portal',
elementary_type='string')
obj = self.portal.portal_preferences.newContent(portal_type='Preference') obj = self.portal.portal_preferences.newContent(portal_type='Preference')
obj.enable() obj.enable()
...@@ -634,12 +633,12 @@ class TestPreferences(PropertySheetTestCase): ...@@ -634,12 +633,12 @@ 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._addPropertySheet('Preference', 'DummySystemPreference', self._addProperty('Preference', 'DummySystemPreference',
'''class DummySystemPreference: portal_type='Standard Property',
_properties= ( {'id': 'dummystring', property_id='dummystring',
'default': '%s', property_default='python: "%s"' % default_preference_string,
'preference': True, preference=True,
'type': 'string',},)''' % default_preference_string) elementary_type='string')
portal_preferences = self.portal.portal_preferences portal_preferences = self.portal.portal_preferences
self.assertEqual(default_preference_string, self.assertEqual(default_preference_string,
portal_preferences.getDummystring()) portal_preferences.getDummystring())
...@@ -668,12 +667,12 @@ class TestPreferences(PropertySheetTestCase): ...@@ -668,12 +667,12 @@ 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._addPropertySheet('Preference', 'DummySystemPreference', self._addProperty('Preference', 'DummySystemPreference',
'''class DummySystemPreference: portal_type='Standard Property',
_properties= ( {'id': 'dummystring', property_id='dummystring',
'default': '%s', property_default='python: "%s"' % default_preference_string,
'preference': True, preference=True,
'type': 'string',},)''' % default_preference_string) elementary_type='string')
portal_preferences = self.portal.portal_preferences portal_preferences = self.portal.portal_preferences
self.assertEqual(default_preference_string, self.assertEqual(default_preference_string,
portal_preferences.getDummystring()) portal_preferences.getDummystring())
......
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