Commit bb83bc0d authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

check PDF rendering using OOo style.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40497 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f2bc42e3
...@@ -29,7 +29,8 @@ ...@@ -29,7 +29,8 @@
import unittest import unittest
import transaction import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase 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.ERP5OOo.tests.utils import Validator from Products.ERP5OOo.tests.utils import Validator
...@@ -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')
...@@ -83,6 +86,15 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -83,6 +86,15 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
self.portal.portal_selections.setSelectionFor( self.portal.portal_selections.setSelectionFor(
'person_module_selection', Selection()) 'person_module_selection', Selection())
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 ERP5TypeTestCase.publish(self, *args, **kw) return ERP5TypeTestCase.publish(self, *args, **kw)
...@@ -177,7 +189,7 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -177,7 +189,7 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
self._validate(response.getBody()) self._validate(response.getBody())
def test_form_view_format(self): def test_form_view_format(self):
# empty format= does not uses oood for conversion # empty format= does not use oood for conversion
response = self.publish( response = self.publish(
'/%s/person_module/pers/Person_view?format=' '/%s/person_module/pers/Person_view?format='
% self.portal.getId(), self.auth) % self.portal.getId(), self.auth)
...@@ -187,6 +199,15 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -187,6 +199,15 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
content_disposition = response.getHeader('content-disposition') content_disposition = response.getHeader('content-disposition')
self.assertEquals('attachment', content_disposition.split(';')[0]) self.assertEquals('attachment', content_disposition.split(';')[0])
self._validate(response.getBody()) self._validate(response.getBody())
# format=pdf uses oood for conversion
response = self.publish(
'/%s/person_module/pers/Person_view?format=pdf'
% self.portal.getId(), self.auth)
self.assertEquals(HTTP_OK, response.getStatus())
content_type = response.getHeader('content-type')
self.assertEquals(content_type, 'application/pdf')
content_disposition = response.getHeader('content-disposition')
self.assertEquals('attachment', content_disposition.split(';')[0])
def test_report_view_form_view(self): def test_report_view_form_view(self):
# Test report view rendering forms using form_view # Test report view rendering forms using form_view
......
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