Commit 44f6a7b9 authored by Tatuya Kamada's avatar Tatuya Kamada

- turn on run_all_test flag

- append XML validation
- append comments to report section test



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26507 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 42ac5ca2
...@@ -31,12 +31,13 @@ from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase ...@@ -31,12 +31,13 @@ from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.utils import createZODBPythonScript from Products.ERP5Type.tests.utils import createZODBPythonScript
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5OOo.OOoUtils import OOoBuilder from Products.ERP5OOo.OOoUtils import OOoBuilder
from Products.ERP5OOo.tests.utils import Validator
from zLOG import LOG , INFO from zLOG import LOG , INFO
from lxml import etree from lxml import etree
import os import os
class TestFormPrintout(ERP5TypeTestCase): class TestFormPrintout(ERP5TypeTestCase):
run_all_test = 0 run_all_test = 1
def getTitle(self): def getTitle(self):
""" """
...@@ -96,13 +97,23 @@ class TestFormPrintout(ERP5TypeTestCase): ...@@ -96,13 +97,23 @@ class TestFormPrintout(ERP5TypeTestCase):
test1.newContent("foo_2", portal_type='Foo Line') test1.newContent("foo_2", portal_type='Foo Line')
get_transaction().commit() get_transaction().commit()
self.tic() self.tic()
# XML validator
v12schema_url = os.path.join(os.path.dirname(__file__),
'OpenDocument-schema-v1.2-draft9.rng')
self.validator = Validator(schema_url=v12schema_url)
def login(self): def login(self):
uf = self.getPortal().acl_users uf = self.getPortal().acl_users
uf._doAddUser('tatuya', '', ['Manager'], []) uf._doAddUser('tatuya', '', ['Manager'], [])
user = uf.getUserById('tatuya').__of__(uf) user = uf.getUserById('tatuya').__of__(uf)
newSecurityManager(None, user) newSecurityManager(None, user)
def _validate(self, odf_file_data):
error_list = self.validator.validate(odf_file_data)
if error_list:
self.fail(''.join(error_list))
def test_01_Paragraph(self, run=run_all_test): def test_01_Paragraph(self, run=run_all_test):
""" """
mapping a field to a paragraph mapping a field to a paragraph
...@@ -572,6 +583,8 @@ class TestFormPrintout(ERP5TypeTestCase): ...@@ -572,6 +583,8 @@ class TestFormPrintout(ERP5TypeTestCase):
erp5form.addERP5Form(id='Foo2_view', title='Foo2') erp5form.addERP5Form(id='Foo2_view', title='Foo2')
foo2_view = custom.Foo2_view foo2_view = custom.Foo2_view
# Attention: Report.py popReport, pushReport
# only accepts named 'listbox' Listbox
foo2_view.manage_addField('listbox', 'listbox', 'ListBox') foo2_view.manage_addField('listbox', 'listbox', 'ListBox')
listbox = foo2_view.listbox listbox = foo2_view.listbox
...@@ -630,6 +643,8 @@ return report_section_list ...@@ -630,6 +643,8 @@ return report_section_list
frame1_list = content.xpath(frame1_xpath, namespaces=content.nsmap) frame1_list = content.xpath(frame1_xpath, namespaces=content.nsmap)
self.assertEqual(len(frame1_list), 1) self.assertEqual(len(frame1_list), 1)
self._validate(odf_document)
# 02. no report section # 02. no report section
custom.manage_delObjects(['FooReport_getReportSectionList']) custom.manage_delObjects(['FooReport_getReportSectionList'])
createZODBPythonScript( createZODBPythonScript(
......
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