tests: make sure ui test page templates can be rendered
In case there is an error in the TALES experession and the page cannot be rendered, then this page will silently be ignored.
Showing
-
Owner
I also tried to validate that the page template are html valid, but none of them have a doctype, so w3c validator complained for that.
I gave up after this patch:
diff --git a/product/ERP5Type/tests/ERP5TypeFunctionalTestCase.py b/product/ERP5Type/tests/ERP5TypeFunctionalTestCase.py index d48b576..0e84f22 100644 --- a/product/ERP5Type/tests/ERP5TypeFunctionalTestCase.py +++ b/product/ERP5Type/tests/ERP5TypeFunctionalTestCase.py @@ -36,6 +36,7 @@ import shutil import transaction from ZPublisher.HTTPResponse import HTTPResponse from zExceptions.ExceptionFormatter import format_exception +from Products.ERP5.tests.testXHTML import validator, validate_xhtml from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase, \ _getConversionServerDict @@ -414,7 +415,7 @@ class ERP5TypeFunctionalTestCase(ERP5TypeTestCase): for page_template_path, page_template in tests_tool.ZopeFind( tests_tool, obj_metatypes=['Page Template'], search_sub=1): try: - page_template.pt_render() + source = page_template.pt_render() except (KeyboardInterrupt, SystemExit): raise except: @@ -426,6 +427,18 @@ class ERP5TypeFunctionalTestCase(ERP5TypeTestCase): exc_value, exc_traceback, as_html=False)))) + else: + if validator: + # XXX testXHTML just expose a validator already initialised, + # without the ability to control show_warnings. + # test zuite page have no doctype + validator.show_warnings = False + + self.assert_(*validate_xhtml( + validator=validator, + source=source, + view_name=page_template_path, + bt_name='')) def testFunctionalTestRunner(self):
Please register or sign in to comment