Commit 3f9f68eb authored by Nicolas Delaby's avatar Nicolas Delaby

Add skip decorator for test_09 and validate ODF against RelaxNG

only for this test. OOo does not produce compliant xml,
and RelaxNG istself is still draft.
So, validation fails even with unmodified xml.
reviewed by Seb


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32065 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6d7d566f
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
import unittest import unittest
import transaction import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.backportUnittest import skip
from Products.ERP5OOo.tests.testFormPrintout import TestFormPrintoutMixin from Products.ERP5OOo.tests.testFormPrintout import TestFormPrintoutMixin
from Products.ERP5Type.tests.utils import createZODBPythonScript from Products.ERP5Type.tests.utils import createZODBPythonScript
from Products.MimetypesRegistry.mime_types.magic import guessMime from Products.MimetypesRegistry.mime_types.magic import guessMime
...@@ -1156,9 +1157,10 @@ return [] ...@@ -1156,9 +1157,10 @@ return []
#test_output.write(printout.data) #test_output.write(printout.data)
self.assertEqual('application/msword', guessMime(printout.data)) self.assertEqual('application/msword', guessMime(printout.data))
def test_09_FieldReplacement(self): def test_09_FieldReplacement(self, validate=False):
"""test field in ODF Documents""" """test field in ODF Documents"""
foo_printout = self.portal.foo_module.test1.Foo5_viewAsPrintout foo_printout = self.portal.foo_module.test1.Foo5_viewAsPrintout
if validate:
self._validate(self.getODFDocumentFromPrintout(foo_printout)) self._validate(self.getODFDocumentFromPrintout(foo_printout))
foo_form = self.portal.foo_module.test1.Foo_view foo_form = self.portal.foo_module.test1.Foo_view
field_name = 'your_checkbox' field_name = 'your_checkbox'
...@@ -1168,6 +1170,7 @@ return [] ...@@ -1168,6 +1170,7 @@ return []
checkbox.values['default'] = 1 checkbox.values['default'] = 1
odf_document = foo_printout(self.portal.REQUEST) odf_document = foo_printout(self.portal.REQUEST)
if validate:
self._validate(odf_document) self._validate(odf_document)
builder = OOoBuilder(odf_document) builder = OOoBuilder(odf_document)
content_xml = builder.extract("content.xml") content_xml = builder.extract("content.xml")
...@@ -1177,6 +1180,7 @@ return [] ...@@ -1177,6 +1180,7 @@ return []
checkbox.values['default'] = 0 checkbox.values['default'] = 0
odf_document = foo_printout(self.portal.REQUEST) odf_document = foo_printout(self.portal.REQUEST)
if validate:
self._validate(odf_document) self._validate(odf_document)
builder = OOoBuilder(odf_document) builder = OOoBuilder(odf_document)
content_xml = builder.extract("content.xml") content_xml = builder.extract("content.xml")
...@@ -1184,6 +1188,13 @@ return [] ...@@ -1184,6 +1188,13 @@ return []
node = document_tree.xpath('//form:checkbox[@form:name = "%s"]' % field_name, namespaces=document_tree.nsmap)[0] node = document_tree.xpath('//form:checkbox[@form:name = "%s"]' % field_name, namespaces=document_tree.nsmap)[0]
self.assertFalse(node.get('{%s}current-state' % document_tree.nsmap['form'])) self.assertFalse(node.get('{%s}current-state' % document_tree.nsmap['form']))
@skip('Disable validation because OOo does not produce compliant'\
' xml, and RelaxNG status is still draft')
def test_09_FieldReplacementWithValidation(self):
"""
"""
return self.test_09_FieldReplacement(validate=True)
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestFormPrintoutAsODT)) suite.addTest(unittest.makeSuite(TestFormPrintoutAsODT))
......
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