Commit 228e3f79 authored by Jérome Perrin's avatar Jérome Perrin

Revert 3 latest commits

Revert "Test deferred style with converting to a format"

This reverts commit cbfa8d56.
-> pushed by mistake

Revert "Set cloudoo on preferences in ERP5TypeTestCase"

This reverts commit 28824962.
-> pushed by mistake

Revert "Listbox from Folder_viewWorkflowActionDialog has hidden columns"

This reverts commit 802d3f53.
-> a test is failing
parent cbfa8d56
...@@ -488,6 +488,9 @@ class TestUNG(ERP5TypeTestCase): ...@@ -488,6 +488,9 @@ 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")
......
...@@ -102,19 +102,19 @@ ...@@ -102,19 +102,19 @@
</tuple> </tuple>
<tuple> <tuple>
<string>portal_type</string> <string>portal_type</string>
<string></string> <string>Portal Type</string>
</tuple> </tuple>
<tuple> <tuple>
<string>state_var</string> <string>state_var</string>
<string></string> <string>Variable</string>
</tuple> </tuple>
<tuple> <tuple>
<string>workflow_state</string> <string>workflow_state</string>
<string></string> <string>State ID</string>
</tuple> </tuple>
<tuple> <tuple>
<string>relative_url</string> <string>relative_url</string>
<string></string> <string>Relative URL</string>
</tuple> </tuple>
</list> </list>
</value> </value>
......
41093 41091
\ No newline at end of file \ No newline at end of file
...@@ -61,11 +61,8 @@ class TestAuoLogout(ERP5TypeTestCase): ...@@ -61,11 +61,8 @@ class TestAuoLogout(ERP5TypeTestCase):
self.login(self.manager_username) self.login(self.manager_username)
# setup short auto-logout period # setup short auto-logout period
preference = self.portal.portal_preferences[ portal.portal_preferences.default_site_preference.setPreferredMaxUserInactivityDuration(5)
self.getDefaultSitePreferenceId()] portal.portal_preferences.default_site_preference.enable()
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,9 +33,10 @@ import os ...@@ -33,9 +33,10 @@ 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
...@@ -93,6 +94,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -93,6 +94,7 @@ 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):
...@@ -118,6 +120,15 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -118,6 +120,15 @@ 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,9 +29,10 @@ ...@@ -29,9 +29,10 @@
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
...@@ -956,6 +957,9 @@ class TestCRMMailSend(BaseTestCRM): ...@@ -956,6 +957,9 @@ 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,6 +114,7 @@ class TestERP5Coordinate(ERP5TypeTestCase): ...@@ -114,6 +114,7 @@ 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())
...@@ -123,6 +124,7 @@ class TestERP5Coordinate(ERP5TypeTestCase): ...@@ -123,6 +124,7 @@ 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())
...@@ -315,6 +317,7 @@ class TestERP5Coordinate(ERP5TypeTestCase): ...@@ -315,6 +317,7 @@ 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,7 +29,9 @@ ...@@ -29,7 +29,9 @@
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):
...@@ -57,6 +59,21 @@ class TestERP5WebWithCRM(ERP5TypeTestCase): ...@@ -57,6 +59,21 @@ 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,8 +34,9 @@ from lxml import etree ...@@ -34,8 +34,9 @@ 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
...@@ -108,10 +109,20 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -108,10 +109,20 @@ 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,11 +28,13 @@ ...@@ -28,11 +28,13 @@
############################################################################## ##############################################################################
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}))?"
...@@ -92,6 +94,11 @@ class TestWebCrawler(ERP5TypeTestCase): ...@@ -92,6 +94,11 @@ 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,6 +32,7 @@ from DateTime import DateTime ...@@ -32,6 +32,7 @@ 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):
...@@ -117,8 +118,23 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase): ...@@ -117,8 +118,23 @@ 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,6 +31,7 @@ ...@@ -31,6 +31,7 @@
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
...@@ -46,6 +47,15 @@ class TestFormPrintoutMixin(ERP5TypeTestCase): ...@@ -46,6 +47,15 @@ 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:
......
...@@ -39,7 +39,6 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -39,7 +39,6 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
skin = content_type = None skin = content_type = None
recipient_email_address = 'invalid@example.com' recipient_email_address = 'invalid@example.com'
attachment_file_extension = '' attachment_file_extension = ''
format = ''
username = 'bob' username = 'bob'
password = 'bobpwd' password = 'bobpwd'
# the weird '<' char is to force quoting of the first name on the e-mail # the weird '<' char is to force quoting of the first name on the e-mail
...@@ -84,8 +83,8 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -84,8 +83,8 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
self.loginAsUser('bob') self.loginAsUser('bob')
self.portal.changeSkin('Deferred') self.portal.changeSkin('Deferred')
response = self.publish( response = self.publish(
'/%s/person_module/pers/Base_viewHistory?deferred_portal_skin=%s&format=%s' '/%s/person_module/pers/Base_viewHistory?deferred_portal_skin=%s'
% (self.portal.getId(), self.skin, self.format), '%s:%s' % (self.username, self.password)) % (self.portal.getId(), self.skin), '%s:%s' % (self.username, self.password))
self.tic() self.tic()
last_message = self.portal.MailHost._last_message last_message = self.portal.MailHost._last_message
self.assertNotEquals((), last_message) self.assertNotEquals((), last_message)
...@@ -103,12 +102,9 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -103,12 +102,9 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
self.assertEquals('attachment; filename="%s"' % expected_file_name, self.assertEquals('attachment; filename="%s"' % expected_file_name,
part.get('Content-Disposition')) part.get('Content-Disposition'))
data = part.get_payload(decode=True) data = part.get_payload(decode=True)
if self.format == '': error_list = Validator().validate(data)
error_list = Validator().validate(data) if error_list:
if error_list: self.fail(''.join(error_list))
self.fail(''.join(error_list))
elif self.format == 'pdf':
self.assertTrue(data.startswith('%PDF'))
break break
else: else:
self.fail('Attachment not found in email\n%s' % message_text) self.fail('Attachment not found in email\n%s' % message_text)
...@@ -120,9 +116,8 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -120,9 +116,8 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
response = self.publish( response = self.publish(
'/%s/person_module/pers/Base_callDialogMethod?deferred_portal_skin=%s&' '/%s/person_module/pers/Base_callDialogMethod?deferred_portal_skin=%s&'
'dialog_method=Person_view&dialog_id=Person_view&' 'dialog_method=Person_view&dialog_id=Person_view&'
'deferred_style:int=1&format=%s&junk=%s' % (self.portal.getId(), 'deferred_style:int=1&junk=%s' % (self.portal.getId(),
self.skin, self.skin,
self.format,
'X' * 2000), 'X' * 2000),
'%s:%s' % (self.username, self.password)) '%s:%s' % (self.username, self.password))
self.tic() self.tic()
...@@ -141,12 +136,9 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -141,12 +136,9 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
self.assertEquals('attachment; filename="%s"' % expected_file_name, self.assertEquals('attachment; filename="%s"' % expected_file_name,
part.get('Content-Disposition')) part.get('Content-Disposition'))
data = part.get_payload(decode=True) data = part.get_payload(decode=True)
if self.format == '': error_list = Validator().validate(data)
error_list = Validator().validate(data) if error_list:
if error_list: self.fail(''.join(error_list))
self.fail(''.join(error_list))
elif self.format == 'pdf':
self.assertTrue(data.startswith('%PDF'))
break break
else: else:
self.fail('Attachment not found in email\n%s' % message_text) self.fail('Attachment not found in email\n%s' % message_text)
...@@ -157,42 +149,16 @@ class TestODSDeferredStyle(TestDeferredStyle): ...@@ -157,42 +149,16 @@ class TestODSDeferredStyle(TestDeferredStyle):
content_type = 'application/vnd.oasis.opendocument.spreadsheet' content_type = 'application/vnd.oasis.opendocument.spreadsheet'
attachment_file_extension = '.ods' attachment_file_extension = '.ods'
class TestODSDeferredStyleFormatXLSX(TestDeferredStyle):
skin = 'ODS'
content_type = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
attachment_file_extension = '.xlsx'
format = 'xlsx'
class TestODSDeferredStyleFormatPDF(TestDeferredStyle):
skin = 'ODS'
content_type = 'application/pdf'
attachment_file_extension = '.pdf'
format = 'pdf'
class TestODTDeferredStyle(TestDeferredStyle): class TestODTDeferredStyle(TestDeferredStyle):
skin = 'ODT' skin = 'ODT'
content_type = 'application/vnd.oasis.opendocument.text' content_type = 'application/vnd.oasis.opendocument.text'
attachment_file_extension = '.odt' attachment_file_extension = '.odt'
class TestODTDeferredStyleFormatDOCX(TestDeferredStyle):
skin = 'ODT'
content_type = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
attachment_file_extension = '.docx'
format = 'docx'
class TestODTDeferredStyleFormatPDF(TestDeferredStyle):
skin = 'ODT'
content_type = 'application/pdf'
attachment_file_extension = '.pdf'
format = 'pdf'
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestODSDeferredStyle)) suite.addTest(unittest.makeSuite(TestODSDeferredStyle))
suite.addTest(unittest.makeSuite(TestODSDeferredStyleFormatXLSX))
suite.addTest(unittest.makeSuite(TestODSDeferredStyleFormatPDF))
suite.addTest(unittest.makeSuite(TestODTDeferredStyle)) suite.addTest(unittest.makeSuite(TestODTDeferredStyle))
suite.addTest(unittest.makeSuite(TestODTDeferredStyleFormatDOCX))
suite.addTest(unittest.makeSuite(TestODTDeferredStyleFormatPDF))
return suite return suite
...@@ -54,6 +54,7 @@ from cgi import FieldStorage ...@@ -54,6 +54,7 @@ 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
...@@ -126,6 +127,9 @@ class TestDocumentMixin(ERP5TypeTestCase): ...@@ -126,6 +127,9 @@ 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,6 +58,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin): ...@@ -58,6 +58,7 @@ 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,6 +52,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): ...@@ -52,6 +52,7 @@ 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,6 +142,9 @@ class TestIngestion(ERP5TypeTestCase): ...@@ -142,6 +142,9 @@ 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,10 +104,8 @@ class TestOoodResponse(ERP5TypeTestCase): ...@@ -104,10 +104,8 @@ 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
# Unset oood coordinates in preferences # This assumes that a conversion error is raised because oood coordinates
preference = self.portal.portal_preferences[ # are not defined in 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',
...@@ -117,11 +115,8 @@ class TestOoodResponse(ERP5TypeTestCase): ...@@ -117,11 +115,8 @@ 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
# Unset oood coordinates in preferences # This assumes that a conversion error is raised because oood coordinates
preference = self.portal.portal_preferences[ # are not defined in 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,9 +32,11 @@ import os ...@@ -32,9 +32,11 @@ 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):
...@@ -55,6 +57,11 @@ class TestOOoImportMixin(ERP5TypeTestCase): ...@@ -55,6 +57,11 @@ 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,9 +28,10 @@ ...@@ -28,9 +28,10 @@
############################################################################## ##############################################################################
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
...@@ -52,6 +53,8 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -52,6 +53,8 @@ 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')
...@@ -82,6 +85,15 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -82,6 +85,15 @@ 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,6 +34,7 @@ import unittest ...@@ -34,6 +34,7 @@ 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
...@@ -146,6 +147,9 @@ class TestERP5DocumentSyncMLMixin(TestERP5SyncMLMixin): ...@@ -146,6 +147,9 @@ 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,9 +889,6 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin): ...@@ -889,9 +889,6 @@ 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