Commit ce9e92bf authored by Jérome Perrin's avatar Jérome Perrin

Set cloudoo on preferences in ERP5TypeTestCase

This has an impact on existing tests, because now the preference will always be
set, so tests won't have to handle cloudooo preference themselves.
parent 43ebcbd8
...@@ -488,9 +488,6 @@ class TestUNG(ERP5TypeTestCase): ...@@ -488,9 +488,6 @@ class TestUNG(ERP5TypeTestCase):
self.logout() self.logout()
self.assertEquals(json.loads(self.portal.Base_getPreferencePathList()), None) self.assertEquals(json.loads(self.portal.Base_getPreferencePathList()), None)
self.login("ERP5TypeTestCase") self.login("ERP5TypeTestCase")
self.changeSkin("UNGDoc")
preference_dict = json.loads(self.portal.Base_getPreferencePathList())
self.assertEquals(preference_dict, {})
self.portal.portal_preferences.ung_preference.enable() self.portal.portal_preferences.ung_preference.enable()
self.tic() self.tic()
self.changeSkin("UNGDoc") self.changeSkin("UNGDoc")
......
...@@ -61,8 +61,11 @@ class TestAuoLogout(ERP5TypeTestCase): ...@@ -61,8 +61,11 @@ class TestAuoLogout(ERP5TypeTestCase):
self.login(self.manager_username) self.login(self.manager_username)
# setup short auto-logout period # setup short auto-logout period
portal.portal_preferences.default_site_preference.setPreferredMaxUserInactivityDuration(5) preference = self.portal.portal_preferences[
portal.portal_preferences.default_site_preference.enable() self.getDefaultSitePreferenceId()]
preference.setPreferredMaxUserInactivityDuration(5)
if self.portal.portal_workflow.isTransitionPossible(preference, 'enable'):
preference.enable()
self.tic() self.tic()
def test_01_AutoLogout(self): def test_01_AutoLogout(self):
......
...@@ -33,10 +33,9 @@ import os ...@@ -33,10 +33,9 @@ import os
from Testing import ZopeTestCase from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase,\
_getConversionServerDict
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
from AccessControl import getSecurityManager from AccessControl import getSecurityManager
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.Sequence import SequenceList from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Type.Base import Base from Products.ERP5Type.Base import Base
from Products.ERP5Type.Utils import convertToUpperCase from Products.ERP5Type.Utils import convertToUpperCase
...@@ -94,7 +93,6 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -94,7 +93,6 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
portal_catalog = self.getCatalogTool() portal_catalog = self.getCatalogTool()
#portal_catalog.manage_catalogClear() #portal_catalog.manage_catalogClear()
self.createCategories() self.createCategories()
self.setDefaultSitePreference()
#Overwrite immediateReindexObject() with a crashing method #Overwrite immediateReindexObject() with a crashing method
def crashingMethod(self): def crashingMethod(self):
...@@ -120,15 +118,6 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -120,15 +118,6 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
o = self.category_tool.group.newContent(portal_type='Category', o = self.category_tool.group.newContent(portal_type='Category',
id=category_id) id=category_id)
def setDefaultSitePreference(self):
default_pref = self.portal.portal_preferences.default_site_preference
conversion_dict = _getConversionServerDict()
default_pref.setPreferredOoodocServerAddress(conversion_dict['hostname'])
default_pref.setPreferredOoodocServerPortNumber(conversion_dict['port'])
if self.portal.portal_workflow.isTransitionPossible(default_pref, 'enable'):
default_pref.enable()
return default_pref
def stepRemoveWorkflowsRelated(self, sequence=None, sequence_list=None, def stepRemoveWorkflowsRelated(self, sequence=None, sequence_list=None,
**kw): **kw):
""" """
......
...@@ -29,10 +29,9 @@ ...@@ -29,10 +29,9 @@
import unittest import unittest
import os import os
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.CMFCore.WorkflowCore import WorkflowException from Products.CMFCore.WorkflowCore import WorkflowException
from Products.ERP5Type.tests.utils import FileUpload from Products.ERP5Type.tests.utils import FileUpload
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase,\
_getConversionServerDict
from Products.ERP5OOo.tests.testIngestion import FILENAME_REGULAR_EXPRESSION from Products.ERP5OOo.tests.testIngestion import FILENAME_REGULAR_EXPRESSION
from Products.ERP5OOo.tests.testIngestion import REFERENCE_REGULAR_EXPRESSION from Products.ERP5OOo.tests.testIngestion import REFERENCE_REGULAR_EXPRESSION
from Products.ERP5Type.tests.backportUnittest import expectedFailure from Products.ERP5Type.tests.backportUnittest import expectedFailure
...@@ -957,9 +956,6 @@ class TestCRMMailSend(BaseTestCRM): ...@@ -957,9 +956,6 @@ class TestCRMMailSend(BaseTestCRM):
# set preference # set preference
default_pref = self.portal.portal_preferences.default_site_preference default_pref = self.portal.portal_preferences.default_site_preference
conversion_dict = _getConversionServerDict()
default_pref.setPreferredOoodocServerAddress(conversion_dict['hostname'])
default_pref.setPreferredOoodocServerPortNumber(conversion_dict['port'])
default_pref.setPreferredDocumentFilenameRegularExpression(FILENAME_REGULAR_EXPRESSION) default_pref.setPreferredDocumentFilenameRegularExpression(FILENAME_REGULAR_EXPRESSION)
default_pref.setPreferredDocumentReferenceRegularExpression(REFERENCE_REGULAR_EXPRESSION) default_pref.setPreferredDocumentReferenceRegularExpression(REFERENCE_REGULAR_EXPRESSION)
if default_pref.getPreferenceState() == 'disabled': if default_pref.getPreferenceState() == 'disabled':
......
...@@ -114,7 +114,6 @@ class TestERP5Coordinate(ERP5TypeTestCase): ...@@ -114,7 +114,6 @@ class TestERP5Coordinate(ERP5TypeTestCase):
pref = self.portal.portal_preferences.default_site_preference pref = self.portal.portal_preferences.default_site_preference
pref.setPreferredTelephoneDefaultCountryNumber('33') pref.setPreferredTelephoneDefaultCountryNumber('33')
pref.setPreferredTelephoneDefaultAreaNumber('2') pref.setPreferredTelephoneDefaultAreaNumber('2')
pref.enable()
tel.fromText(coordinate_text='11111111') tel.fromText(coordinate_text='11111111')
self.assertEquals('+33(0)2-11111111',tel.asText()) self.assertEquals('+33(0)2-11111111',tel.asText())
...@@ -124,7 +123,6 @@ class TestERP5Coordinate(ERP5TypeTestCase): ...@@ -124,7 +123,6 @@ class TestERP5Coordinate(ERP5TypeTestCase):
pref = self.portal.portal_preferences.default_site_preference pref = self.portal.portal_preferences.default_site_preference
pref.setPreferredTelephoneDefaultCountryNumber('') pref.setPreferredTelephoneDefaultCountryNumber('')
pref.setPreferredTelephoneDefaultAreaNumber('') pref.setPreferredTelephoneDefaultAreaNumber('')
pref.enable()
tel.fromText(coordinate_text='+11 1 11111111') tel.fromText(coordinate_text='+11 1 11111111')
tel.fromText(coordinate_text='+22333445555') tel.fromText(coordinate_text='+22333445555')
self.assertEquals('+(0)-22333445555',tel.asText()) self.assertEquals('+(0)-22333445555',tel.asText())
...@@ -317,7 +315,6 @@ class TestERP5Coordinate(ERP5TypeTestCase): ...@@ -317,7 +315,6 @@ class TestERP5Coordinate(ERP5TypeTestCase):
pref = self.portal.portal_preferences.default_site_preference pref = self.portal.portal_preferences.default_site_preference
pref.setPreferredTelephoneDefaultCountryNumber('') pref.setPreferredTelephoneDefaultCountryNumber('')
pref.setPreferredTelephoneDefaultAreaNumber('') pref.setPreferredTelephoneDefaultAreaNumber('')
pref.enable()
tel.fromText(coordinate_text='12345678') tel.fromText(coordinate_text='12345678')
self.assertEquals('+(0)-12345678',tel.asText()) self.assertEquals('+(0)-12345678',tel.asText())
......
...@@ -29,9 +29,7 @@ ...@@ -29,9 +29,7 @@
import unittest import unittest
import transaction import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase,\
_getConversionServerDict
class TestERP5WebWithCRM(ERP5TypeTestCase): class TestERP5WebWithCRM(ERP5TypeTestCase):
...@@ -59,21 +57,6 @@ class TestERP5WebWithCRM(ERP5TypeTestCase): ...@@ -59,21 +57,6 @@ class TestERP5WebWithCRM(ERP5TypeTestCase):
user = self.createUser('robby') user = self.createUser('robby')
self.createUserAssignment(user, {}) self.createUserAssignment(user, {})
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]
conversion_dict = _getConversionServerDict()
preference.setPreferredOoodocServerAddress(conversion_dict['hostname'])
preference.setPreferredOoodocServerPortNumber(conversion_dict['port'])
if self.portal.portal_workflow.isTransitionPossible(preference, 'enable'):
preference.enable()
def clearModule(self, module): def clearModule(self, module):
module.manage_delObjects(list(module.objectIds())) module.manage_delObjects(list(module.objectIds()))
self.tic() self.tic()
......
...@@ -34,9 +34,8 @@ from lxml import etree ...@@ -34,9 +34,8 @@ from lxml import etree
from AccessControl import Unauthorized from AccessControl import Unauthorized
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Testing import ZopeTestCase from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase,\
_getConversionServerDict
from Products.ERP5Type.tests.utils import FileUpload, createZODBPythonScript from Products.ERP5Type.tests.utils import FileUpload, createZODBPythonScript
from Products.ERP5.Document.Document import ConversionError from Products.ERP5.Document.Document import ConversionError
...@@ -109,20 +108,10 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -109,20 +108,10 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
def afterSetUp(self): def afterSetUp(self):
self.login() self.login()
portal = self.getPortal() portal = self.getPortal()
self.setDefaultSitePreference()
self.web_page_module = self.portal.web_page_module self.web_page_module = self.portal.web_page_module
self.web_site_module = self.portal.web_site_module self.web_site_module = self.portal.web_site_module
self.portal_id = self.portal.getId() self.portal_id = self.portal.getId()
def setDefaultSitePreference(self):
default_pref = self.portal.portal_preferences.default_site_preference
conversion_dict = _getConversionServerDict()
default_pref.setPreferredOoodocServerAddress(conversion_dict['hostname'])
default_pref.setPreferredOoodocServerPortNumber(conversion_dict['port'])
if self.portal.portal_workflow.isTransitionPossible(default_pref, 'enable'):
default_pref.enable()
return default_pref
def clearModule(self, module): def clearModule(self, module):
module.manage_delObjects(list(module.objectIds())) module.manage_delObjects(list(module.objectIds()))
self.tic() self.tic()
......
...@@ -84,8 +84,8 @@ class TestResource(ERP5TypeTestCase): ...@@ -84,8 +84,8 @@ class TestResource(ERP5TypeTestCase):
preference = portal_preferences.newContent(portal_type='System Preference', preference = portal_preferences.newContent(portal_type='System Preference',
title='Default Site Preference', title='Default Site Preference',
id='test_site_preference') id='test_site_preference')
if preference.getPreferenceState() == 'disabled': if preference.getPreferenceState() == 'disabled':
preference.enable() preference.enable()
preference.setPreferredApparelModelVariationBaseCategoryList(('size', 'industrial_phase',)) preference.setPreferredApparelModelVariationBaseCategoryList(('size', 'industrial_phase',))
preference.setPreferredApparelClothVariationBaseCategoryList(('size',)) preference.setPreferredApparelClothVariationBaseCategoryList(('size',))
......
...@@ -28,13 +28,11 @@ ...@@ -28,13 +28,11 @@
############################################################################## ##############################################################################
import unittest import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase,\
_getConversionServerDict
import urlnorm # This library is imported to detect lack of import urlnorm # This library is imported to detect lack of
# urlnorm availibility in python environment # urlnorm availibility in python environment
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
# test files' home
FILENAME_REGULAR_EXPRESSION = "(?P<reference>[A-Z&é@{]{3,7})-(?P<language>[a-z]{2})-(?P<version>[0-9]{3})" FILENAME_REGULAR_EXPRESSION = "(?P<reference>[A-Z&é@{]{3,7})-(?P<language>[a-z]{2})-(?P<version>[0-9]{3})"
REFERENCE_REGULAR_EXPRESSION = "(?P<reference>[A-Z&é@{]{3,7})(-(?P<language>[a-z]{2}))?(-(?P<version>[0-9]{3}))?" REFERENCE_REGULAR_EXPRESSION = "(?P<reference>[A-Z&é@{]{3,7})(-(?P<language>[a-z]{2}))?(-(?P<version>[0-9]{3}))?"
...@@ -94,11 +92,6 @@ class TestWebCrawler(ERP5TypeTestCase): ...@@ -94,11 +92,6 @@ class TestWebCrawler(ERP5TypeTestCase):
if system_preference is None: if system_preference is None:
system_preference = portal_preferences.newContent(id=self.system_pref_id, system_preference = portal_preferences.newContent(id=self.system_pref_id,
portal_type='System Preference') portal_type='System Preference')
conversion_dict = _getConversionServerDict()
system_preference.\
setPreferredOoodocServerAddress(conversion_dict['hostname'])
system_preference.\
setPreferredOoodocServerPortNumber(conversion_dict['port'])
system_preference.setPreferredDocumentFilenameRegularExpression( system_preference.setPreferredDocumentFilenameRegularExpression(
FILENAME_REGULAR_EXPRESSION) FILENAME_REGULAR_EXPRESSION)
system_preference.setPreferredDocumentReferenceRegularExpression( system_preference.setPreferredDocumentReferenceRegularExpression(
......
...@@ -32,7 +32,6 @@ from DateTime import DateTime ...@@ -32,7 +32,6 @@ from DateTime import DateTime
from AccessControl import Unauthorized from AccessControl import Unauthorized
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.SecurityTestCase import SecurityTestCase from Products.ERP5Type.tests.SecurityTestCase import SecurityTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import _getConversionServerDict
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...@@ -118,23 +117,8 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): ...@@ -118,23 +117,8 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
# it is required by SecurityTestCase # it is required by SecurityTestCase
self.workflow_tool = self.portal.portal_workflow self.workflow_tool = self.portal.portal_workflow
self.setDefaultSitePreference() self.setDefaultSitePreference()
self.setSystemPreference()
self.portal.portal_activities.unsubscribe() self.portal.portal_activities.unsubscribe()
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]
conversion_dict = _getConversionServerDict()
preference.setPreferredOoodocServerAddress(conversion_dict['hostname'])
preference.setPreferredOoodocServerPortNumber(conversion_dict['port'])
if self.portal.portal_workflow.isTransitionPossible(preference, 'enable'):
preference.enable()
def setDefaultSitePreference(self): def setDefaultSitePreference(self):
default_pref = self.portal.portal_preferences.default_site_preference default_pref = self.portal.portal_preferences.default_site_preference
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import _getConversionServerDict
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
from StringIO import StringIO from StringIO import StringIO
...@@ -47,15 +46,6 @@ class TestFormPrintoutMixin(ERP5TypeTestCase): ...@@ -47,15 +46,6 @@ class TestFormPrintoutMixin(ERP5TypeTestCase):
user = uf.getUserById('zope').__of__(uf) user = uf.getUserById('zope').__of__(uf)
newSecurityManager(None, user) newSecurityManager(None, user)
def setSystemPreference(self):
default_pref = self.portal.portal_preferences.default_site_preference
conversion_dict = _getConversionServerDict()
default_pref.setPreferredOoodocServerAddress(conversion_dict['hostname'])
default_pref.setPreferredOoodocServerPortNumber(conversion_dict['port'])
#default_pref.setPreferredConversionCacheFactory('document_cache_factory')
if default_pref.getPreferenceState() != 'global':
default_pref.enable()
def _validate(self, odf_file_data): def _validate(self, odf_file_data):
error_list = self.validator.validate(odf_file_data) error_list = self.validator.validate(odf_file_data)
if error_list: if error_list:
......
...@@ -54,7 +54,6 @@ from cgi import FieldStorage ...@@ -54,7 +54,6 @@ from cgi import FieldStorage
import ZPublisher.HTTPRequest import ZPublisher.HTTPRequest
from Testing import ZopeTestCase from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import _getConversionServerDict
from Products.ERP5Type.tests.utils import FileUpload from Products.ERP5Type.tests.utils import FileUpload
from Products.ERP5Type.tests.utils import DummyLocalizer from Products.ERP5Type.tests.utils import DummyLocalizer
from Products.ERP5OOo.OOoUtils import OOoBuilder from Products.ERP5OOo.OOoUtils import OOoBuilder
...@@ -127,9 +126,6 @@ class TestDocumentMixin(ERP5TypeTestCase): ...@@ -127,9 +126,6 @@ class TestDocumentMixin(ERP5TypeTestCase):
def setDefaultSitePreference(self): def setDefaultSitePreference(self):
default_pref = self.portal.portal_preferences.default_site_preference default_pref = self.portal.portal_preferences.default_site_preference
conversion_dict = _getConversionServerDict()
default_pref.setPreferredOoodocServerAddress(conversion_dict['hostname'])
default_pref.setPreferredOoodocServerPortNumber(conversion_dict['port'])
default_pref.setPreferredDocumentFilenameRegularExpression(FILENAME_REGULAR_EXPRESSION) default_pref.setPreferredDocumentFilenameRegularExpression(FILENAME_REGULAR_EXPRESSION)
default_pref.setPreferredDocumentReferenceRegularExpression(REFERENCE_REGULAR_EXPRESSION) default_pref.setPreferredDocumentReferenceRegularExpression(REFERENCE_REGULAR_EXPRESSION)
if self.portal.portal_workflow.isTransitionPossible(default_pref, 'enable'): if self.portal.portal_workflow.isTransitionPossible(default_pref, 'enable'):
......
...@@ -58,7 +58,6 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin): ...@@ -58,7 +58,6 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
def afterSetUp(self): def afterSetUp(self):
self.login() self.login()
self.setSystemPreference()
# XML validator # XML validator
v12schema_url = os.path.join(os.path.dirname(__file__), v12schema_url = os.path.join(os.path.dirname(__file__),
'OpenDocument-v1.2-os-schema.rng') 'OpenDocument-v1.2-os-schema.rng')
......
...@@ -52,7 +52,6 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): ...@@ -52,7 +52,6 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin):
def afterSetUp(self): def afterSetUp(self):
self.login() self.login()
self.setSystemPreference()
# XML validator # XML validator
v12schema_url = os.path.join(os.path.dirname(__file__), v12schema_url = os.path.join(os.path.dirname(__file__),
'OpenDocument-v1.2-os-schema.rng') 'OpenDocument-v1.2-os-schema.rng')
......
...@@ -142,9 +142,6 @@ class TestIngestion(ERP5TypeTestCase): ...@@ -142,9 +142,6 @@ class TestIngestion(ERP5TypeTestCase):
def setSystemPreference(self): def setSystemPreference(self):
default_pref = self.portal.portal_preferences.default_site_preference default_pref = self.portal.portal_preferences.default_site_preference
conversion_dict = _getConversionServerDict()
default_pref.setPreferredOoodocServerAddress(conversion_dict['hostname'])
default_pref.setPreferredOoodocServerPortNumber(conversion_dict['port'])
default_pref.setPreferredDocumentFilenameRegularExpression(FILENAME_REGULAR_EXPRESSION) default_pref.setPreferredDocumentFilenameRegularExpression(FILENAME_REGULAR_EXPRESSION)
default_pref.setPreferredDocumentReferenceRegularExpression(REFERENCE_REGULAR_EXPRESSION) default_pref.setPreferredDocumentReferenceRegularExpression(REFERENCE_REGULAR_EXPRESSION)
if default_pref.getPreferenceState() != 'global': if default_pref.getPreferenceState() != 'global':
......
...@@ -104,8 +104,10 @@ class TestOoodResponse(ERP5TypeTestCase): ...@@ -104,8 +104,10 @@ class TestOoodResponse(ERP5TypeTestCase):
request = self.portal.REQUEST request = self.portal.REQUEST
request.RESPONSE.setHeader('content-type', 'text/html') request.RESPONSE.setHeader('content-type', 'text/html')
ERP5Site_viewNothingAsOdt = self.getPortal().ERP5Site_viewNothingAsOdt ERP5Site_viewNothingAsOdt = self.getPortal().ERP5Site_viewNothingAsOdt
# This assumes that a conversion error is raised because oood coordinates # Unset oood coordinates in preferences
# are not defined in preferences. preference = self.portal.portal_preferences[
self.getDefaultSitePreferenceId()]
preference.setPreferredOoodocServerAddress("")
self.assertRaises(ConversionError, ERP5Site_viewNothingAsOdt, self.assertRaises(ConversionError, ERP5Site_viewNothingAsOdt,
batch_mode=0, format='pdf') batch_mode=0, format='pdf')
self.assertEqual('text/html', self.assertEqual('text/html',
...@@ -115,8 +117,11 @@ class TestOoodResponse(ERP5TypeTestCase): ...@@ -115,8 +117,11 @@ class TestOoodResponse(ERP5TypeTestCase):
request = self.portal.REQUEST request = self.portal.REQUEST
request.RESPONSE.setHeader('content-type', 'text/html') request.RESPONSE.setHeader('content-type', 'text/html')
ERP5Site_viewNothingAsOdt = self.getPortal().ERP5Site_viewNothingAsOdt ERP5Site_viewNothingAsOdt = self.getPortal().ERP5Site_viewNothingAsOdt
# This assumes that a conversion error is raised because oood coordinates # Unset oood coordinates in preferences
# are not defined in preferences. preference = self.portal.portal_preferences[
self.getDefaultSitePreferenceId()]
preference.setPreferredOoodocServerAddress("")
self.assertRaises(ConversionError, ERP5Site_viewNothingAsOdt, self.assertRaises(ConversionError, ERP5Site_viewNothingAsOdt,
batch_mode=1, format='pdf') batch_mode=1, format='pdf')
self.assertEqual('text/html', request.RESPONSE.getHeader('content-type').split(';')[0]) self.assertEqual('text/html', request.RESPONSE.getHeader('content-type').split(';')[0])
......
...@@ -32,11 +32,9 @@ import os ...@@ -32,11 +32,9 @@ import os
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import _getConversionServerDict
from Products.ERP5Type.tests.utils import FileUpload from Products.ERP5Type.tests.utils import FileUpload
from Products.ERP5Type.tests.Sequence import SequenceList from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5OOo.OOoUtils import OOoParser from Products.ERP5OOo.OOoUtils import OOoParser
from Products.ERP5Form.PreferenceTool import Priority
from DateTime import DateTime from DateTime import DateTime
def makeFilePath(name): def makeFilePath(name):
...@@ -57,11 +55,6 @@ class TestOOoImportMixin(ERP5TypeTestCase): ...@@ -57,11 +55,6 @@ class TestOOoImportMixin(ERP5TypeTestCase):
self.login() self.login()
self.pref = self.portal.portal_preferences.newContent( self.pref = self.portal.portal_preferences.newContent(
portal_type='System Preference') portal_type='System Preference')
conversion_dict = _getConversionServerDict()
self.pref.setPreferredOoodocServerAddress(conversion_dict['hostname'])
self.pref.setPreferredOoodocServerPortNumber(conversion_dict['port'])
self.pref.setPriority(Priority.SITE)
self.pref.enable()
# create browser_id_manager # create browser_id_manager
if not "browser_id_manager" in self.portal.objectIds(): if not "browser_id_manager" in self.portal.objectIds():
......
...@@ -28,10 +28,9 @@ ...@@ -28,10 +28,9 @@
############################################################################## ##############################################################################
import unittest import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase, \
_getConversionServerDict
from Products.ERP5Form.Selection import Selection from Products.ERP5Form.Selection import Selection
from Testing import ZopeTestCase from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5OOo.tests.utils import Validator from Products.ERP5OOo.tests.utils import Validator
import httplib import httplib
...@@ -53,8 +52,6 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -53,8 +52,6 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
if not self.skin: if not self.skin:
raise NotImplementedError('Subclasses must define skin') raise NotImplementedError('Subclasses must define skin')
self.setDefaultSitePreference()
gender = self.portal.portal_categories.gender gender = self.portal.portal_categories.gender
if 'male' not in gender.objectIds(): if 'male' not in gender.objectIds():
gender.newContent(id='male') gender.newContent(id='male')
...@@ -85,15 +82,6 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -85,15 +82,6 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
name = 'person_module_selection' name = 'person_module_selection'
self.portal.portal_selections.setSelectionFor(name, Selection(name)) self.portal.portal_selections.setSelectionFor(name, Selection(name))
def setDefaultSitePreference(self):
default_pref = self.portal.portal_preferences.default_site_preference
conversion_dict = _getConversionServerDict()
default_pref.setPreferredOoodocServerAddress(conversion_dict['hostname'])
default_pref.setPreferredOoodocServerPortNumber(conversion_dict['port'])
if self.portal.portal_workflow.isTransitionPossible(default_pref, 'enable'):
default_pref.enable()
return default_pref
def publish(self, *args, **kw): def publish(self, *args, **kw):
kw['handle_errors'] = not debug kw['handle_errors'] = not debug
return super(TestOOoStyle, self).publish(*args, **kw) return super(TestOOoStyle, self).publish(*args, **kw)
......
...@@ -34,7 +34,6 @@ import unittest ...@@ -34,7 +34,6 @@ import unittest
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.tests.runUnitTest import tests_home from Products.ERP5Type.tests.runUnitTest import tests_home
from Products.ERP5Type.tests.ERP5TypeTestCase import _getConversionServerDict
from Products.ERP5Type.tests.utils import FileUpload from Products.ERP5Type.tests.utils import FileUpload
from Products.ERP5SyncML.Tool import SynchronizationTool from Products.ERP5SyncML.Tool import SynchronizationTool
from Products.ERP5SyncML.tests.testERP5SyncML import TestERP5SyncMLMixin from Products.ERP5SyncML.tests.testERP5SyncML import TestERP5SyncMLMixin
...@@ -147,9 +146,6 @@ class TestERP5DocumentSyncMLMixin(TestERP5SyncMLMixin): ...@@ -147,9 +146,6 @@ class TestERP5DocumentSyncMLMixin(TestERP5SyncMLMixin):
def setSystemPreferences(self): def setSystemPreferences(self):
default_pref = self.portal.portal_preferences.default_site_preference default_pref = self.portal.portal_preferences.default_site_preference
conversion_dict = _getConversionServerDict()
default_pref.setPreferredOoodocServerAddress(conversion_dict['hostname'])
default_pref.setPreferredOoodocServerPortNumber(conversion_dict['port'])
default_pref.setPreferredDocumentFileNameRegularExpression(FILENAME_REGULAR_EXPRESSION) default_pref.setPreferredDocumentFileNameRegularExpression(FILENAME_REGULAR_EXPRESSION)
default_pref.setPreferredDocumentReferenceRegularExpression(REFERENCE_REGULAR_EXPRESSION) default_pref.setPreferredDocumentReferenceRegularExpression(REFERENCE_REGULAR_EXPRESSION)
if default_pref.getPreferenceState() == 'disabled': if default_pref.getPreferenceState() == 'disabled':
......
...@@ -889,6 +889,9 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin): ...@@ -889,6 +889,9 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin):
preference._setPreferredOoodocServerAddress(conversion_dict['hostname']) preference._setPreferredOoodocServerAddress(conversion_dict['hostname'])
preference._setPreferredOoodocServerPortNumber(conversion_dict['port']) preference._setPreferredOoodocServerPortNumber(conversion_dict['port'])
if self.portal.portal_workflow.isTransitionPossible(preference, 'enable'):
preference.enable()
def _updateMemcachedConfiguration(self): def _updateMemcachedConfiguration(self):
"""Update default memcached plugin configuration """Update default memcached plugin configuration
""" """
......
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