Commit 378385c5 authored by Nicolas Delaby's avatar Nicolas Delaby

Make distinction between Preference and System Preference

in testDms bootstrap step.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34816 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 354347c5
...@@ -107,6 +107,7 @@ class TestDocument(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -107,6 +107,7 @@ class TestDocument(ERP5TypeTestCase, ZopeTestCase.Functional):
## setup ## setup
def setUpOnce(self): def setUpOnce(self):
self.setDefaultSitePreference()
self.setSystemPreference() self.setSystemPreference()
# set a dummy localizer (because normally it is cookie based) # set a dummy localizer (because normally it is cookie based)
self.portal.Localizer = DummyLocalizer() self.portal.Localizer = DummyLocalizer()
...@@ -114,10 +115,11 @@ class TestDocument(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -114,10 +115,11 @@ class TestDocument(ERP5TypeTestCase, ZopeTestCase.Functional):
self.portal.document_module.manage_permission('View', ['Anonymous'], 1) self.portal.document_module.manage_permission('View', ['Anonymous'], 1)
self.portal.document_module.manage_permission( self.portal.document_module.manage_permission(
'Access contents information', ['Anonymous'], 1) 'Access contents information', ['Anonymous'], 1)
transaction.commit()
self.tic()
def setSystemPreference(self): def setDefaultSitePreference(self):
default_pref = self.portal.portal_preferences.newContent(portal_type='System Preference') default_pref = self.portal.portal_preferences.default_site_preference
default_pref.setPriority(1)
default_pref.setPreferredOoodocServerAddress(conversion_server_host[0]) default_pref.setPreferredOoodocServerAddress(conversion_server_host[0])
default_pref.setPreferredOoodocServerPortNumber(conversion_server_host[1]) default_pref.setPreferredOoodocServerPortNumber(conversion_server_host[1])
default_pref.setPreferredDocumentFileNameRegularExpression(FILE_NAME_REGULAR_EXPRESSION) default_pref.setPreferredDocumentFileNameRegularExpression(FILE_NAME_REGULAR_EXPRESSION)
...@@ -126,6 +128,19 @@ class TestDocument(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -126,6 +128,19 @@ class TestDocument(ERP5TypeTestCase, ZopeTestCase.Functional):
default_pref.enable() default_pref.enable()
return default_pref return default_pref
def setSystemPreference(self):
portal_type = 'System Preference'
preference_list = self.portal.portal_preferences.contentValues(
portal_type=portal_type)
if not preference_list:
preference = self.portal.portal_preferences.newContent(
portal_type=portal_type)
else:
preference = preference_list[0]
if preference.getPreferenceState() != 'global':
preference.enable()
return preference
def getDocumentModule(self): def getDocumentModule(self):
return getattr(self.getPortal(),'document_module') return getattr(self.getPortal(),'document_module')
...@@ -1544,6 +1559,7 @@ class TestDocumentWithSecurity(ERP5TypeTestCase): ...@@ -1544,6 +1559,7 @@ class TestDocumentWithSecurity(ERP5TypeTestCase):
return "DMS with security" return "DMS with security"
def afterSetUp(self): def afterSetUp(self):
self.setDefaultSitePreference()
self.setSystemPreference() self.setSystemPreference()
# set a dummy localizer (because normally it is cookie based) # set a dummy localizer (because normally it is cookie based)
self.portal.Localizer = DummyLocalizer() self.portal.Localizer = DummyLocalizer()
...@@ -1551,9 +1567,11 @@ class TestDocumentWithSecurity(ERP5TypeTestCase): ...@@ -1551,9 +1567,11 @@ class TestDocumentWithSecurity(ERP5TypeTestCase):
self.portal.document_module.manage_permission('View', ['Anonymous'], 1) self.portal.document_module.manage_permission('View', ['Anonymous'], 1)
self.portal.document_module.manage_permission( self.portal.document_module.manage_permission(
'Access contents information', ['Anonymous'], 1) 'Access contents information', ['Anonymous'], 1)
transaction.commit()
self.tic()
self.login() self.login()
def setSystemPreference(self): def setDefaultSitePreference(self):
default_pref = self.portal.portal_preferences.default_site_preference default_pref = self.portal.portal_preferences.default_site_preference
default_pref.setPreferredOoodocServerAddress(conversion_server_host[0]) default_pref.setPreferredOoodocServerAddress(conversion_server_host[0])
default_pref.setPreferredOoodocServerPortNumber(conversion_server_host[1]) default_pref.setPreferredOoodocServerPortNumber(conversion_server_host[1])
...@@ -1561,8 +1579,20 @@ class TestDocumentWithSecurity(ERP5TypeTestCase): ...@@ -1561,8 +1579,20 @@ class TestDocumentWithSecurity(ERP5TypeTestCase):
default_pref.setPreferredDocumentReferenceRegularExpression(REFERENCE_REGULAR_EXPRESSION) default_pref.setPreferredDocumentReferenceRegularExpression(REFERENCE_REGULAR_EXPRESSION)
if default_pref.getPreferenceState() != 'global': if default_pref.getPreferenceState() != 'global':
default_pref.enable() default_pref.enable()
transaction.commit() return default_pref
self.tic()
def setSystemPreference(self):
portal_type = 'System Preference'
preference_list = self.portal.portal_preferences.contentValues(
portal_type=portal_type)
if not preference_list:
preference = self.portal.portal_preferences.newContent(
portal_type=portal_type)
else:
preference = preference_list[0]
if preference.getPreferenceState() != 'global':
preference.enable()
return preference
def login(self): def login(self):
uf = self.getPortal().acl_users uf = self.getPortal().acl_users
......
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