[Erp5-report] r31253 fabien - /erp5/trunk/products/ERP5OOo/tests/
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Dec 11 17:13:09 CET 2009
Author: fabien
Date: Fri Dec 11 17:13:06 2009
New Revision: 31253
URL: http://svn.erp5.org?rev=31253&view=rev
Log:
- spread testFormPrintout.py in two parts : testFormPrintoutMixin and
testFormPrintout. This make possible to reuse some methods in
testFormPrintoutAsODG Class.
- fix a small issue in testFormPrintoutAsODG.py
Modified:
erp5/trunk/products/ERP5OOo/tests/testFormPrintout.py
erp5/trunk/products/ERP5OOo/tests/testFormPrintoutAsODG.py
Modified: erp5/trunk/products/ERP5OOo/tests/testFormPrintout.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5OOo/tests/testFormPrintout.py?rev=31253&r1=31252&r2=31253&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/tests/testFormPrintout.py [utf8] (original)
+++ erp5/trunk/products/ERP5OOo/tests/testFormPrintout.py [utf8] Fri Dec 11 17:13:06 2009
@@ -3,6 +3,7 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2009 Nexedi KK and Contributors. All Rights Reserved.
# Tatuya Kamada <tatuya at nexedi.com>
+# Fabien Morin <fabien at nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
@@ -41,22 +42,48 @@
from lxml import etree
import os
-# TODO : move code specific to ODT document to another file like
-# testFormPrintoutAsODT which inherite from this class.
-# This class should contain only common parts to all ODF type tests (odg, odt,
-# ods, ...).
-
-class TestFormPrintout(ERP5TypeTestCase):
+class TestFormPrintoutMixin(ERP5TypeTestCase):
run_all_test = 1
-
- def getTitle(self):
- """
- Return the title of the current test set.
- """
- return "FormPrintout"
def getBusinessTemplateList(self):
return ('erp5_base', 'erp5_ui_test', 'erp5_odt_style')
+
+ def login(self):
+ uf = self.getPortal().acl_users
+ uf._doAddUser('zope', '', ['Manager'], [])
+ user = uf.getUserById('zope').__of__(uf)
+ newSecurityManager(None, user)
+
+ def setSystemPreference(self):
+ default_pref = self.portal.portal_preferences.default_site_preference
+ default_pref.setPreferredOoodocServerAddress('127.0.0.1')
+ default_pref.setPreferredOoodocServerPortNumber('8008')
+ #default_pref.setPreferredConversionCacheFactory('document_cache_factory')
+ if default_pref.getPreferenceState() != 'global':
+ default_pref.enable()
+
+ def _validate(self, odf_file_data):
+ error_list = self.validator.validate(odf_file_data)
+ if error_list:
+ self.fail(''.join(error_list))
+
+ def getODFDocumentFromPrintout(self, printout_form):
+ '''return odf document from the printout
+ '''
+ document_file = getattr(self.portal, printout_form.template, None)
+ document_file = StringIO(document_file).read()
+ if document_file is not None:
+ return document_file
+ raise ValueError ('%s template not found' % printout_form.template)
+
+class TestFormPrintout(TestFormPrintoutMixin):
+ run_all_test = 1
+
+ def getTitle(self):
+ """
+ Return the title of the current test set.
+ """
+ return "FormPrintout"
def afterSetUp(self):
self.login()
@@ -138,34 +165,6 @@
transaction.commit()
self.tic()
- def login(self):
- uf = self.getPortal().acl_users
- uf._doAddUser('tatuya', '', ['Manager'], [])
- user = uf.getUserById('tatuya').__of__(uf)
- newSecurityManager(None, user)
-
- def setSystemPreference(self):
- default_pref = self.portal.portal_preferences.default_site_preference
- default_pref.setPreferredOoodocServerAddress('127.0.0.1')
- default_pref.setPreferredOoodocServerPortNumber('8008')
- #default_pref.setPreferredConversionCacheFactory('document_cache_factory')
- if default_pref.getPreferenceState() != 'global':
- default_pref.enable()
-
- def _validate(self, odf_file_data):
- error_list = self.validator.validate(odf_file_data)
- if error_list:
- self.fail(''.join(error_list))
-
- def getODFDocumentFromPrintout(self, printout_form):
- '''return odf document from the printout
- '''
- document_file = getattr(self.portal, printout_form.template, None)
- document_file = StringIO(document_file).read()
- if document_file is not None:
- return document_file
- raise ValueError ('%s template not found' % printout_form.template)
-
def test_01_Paragraph(self, run=run_all_test):
"""
mapping a field to a paragraph
Modified: erp5/trunk/products/ERP5OOo/tests/testFormPrintoutAsODG.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5OOo/tests/testFormPrintoutAsODG.py?rev=31253&r1=31252&r2=31253&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/tests/testFormPrintoutAsODG.py [utf8] (original)
+++ erp5/trunk/products/ERP5OOo/tests/testFormPrintoutAsODG.py [utf8] Fri Dec 11 17:13:06 2009
@@ -30,13 +30,13 @@
import unittest
import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
-from Products.ERP5OOo.tests.testFormPrintout import TestFormPrintout
+from Products.ERP5OOo.tests.testFormPrintout import TestFormPrintoutMixin
from Products.ERP5OOo.OOoUtils import OOoBuilder
from Products.ERP5OOo.tests.utils import Validator
from lxml import etree
import os
-class TestFormPrintoutAsODG(TestFormPrintout):
+class TestFormPrintoutAsODG(TestFormPrintoutMixin):
run_all_test = 1
def getTitle(self):
@@ -123,8 +123,7 @@
style_dict = {'{urn:oasis:names:tc:opendocument:xmlns:text:1.0}span':
{'{urn:oasis:names:tc:opendocument:xmlns:text:1.0}style-name': 'T2'},
- '{urn:oasis:names:tc:opendocument:xmlns:text:1.0}p':
- {'{urn:oasis:names:tc:opendocument:xmlns:text:1.0}style-name': 'P2'}
+ '{urn:oasis:names:tc:opendocument:xmlns:text:1.0}p': {}
}
# test target
More information about the Erp5-report
mailing list