Commit f32d638d authored by Jérome Perrin's avatar Jérome Perrin

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.
parent 8f84db8e
...@@ -35,6 +35,7 @@ import subprocess ...@@ -35,6 +35,7 @@ import subprocess
import shutil import shutil
import transaction import transaction
from ZPublisher.HTTPResponse import HTTPResponse from ZPublisher.HTTPResponse import HTTPResponse
from zExceptions.ExceptionFormatter import format_exception
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase, \ from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase, \
_getConversionServerDict _getConversionServerDict
...@@ -405,8 +406,30 @@ class ERP5TypeFunctionalTestCase(ERP5TypeTestCase): ...@@ -405,8 +406,30 @@ class ERP5TypeFunctionalTestCase(ERP5TypeTestCase):
return True return True
return False return False
def testCheckZuitePageTemplatesValidHTML(self):
# Check the zuite page templates can be rendered, because selenium test
# runner does not report error in case there are errors in the page
# template.
tests_tool = self.portal.portal_tests
for page_template_path, page_template in tests_tool.ZopeFind(
tests_tool, obj_metatypes=['Page Template'], search_sub=1):
try:
page_template.pt_render()
except (KeyboardInterrupt, SystemExit):
raise
except:
exc_type, exc_value, exc_traceback = sys.exc_info()
self.fail('Rendering of %s failed with error:\n%s' % (
page_template_path,
''.join(format_exception(
exc_type,
exc_value,
exc_traceback,
as_html=False))))
def testFunctionalTestRunner(self): def testFunctionalTestRunner(self):
# first of all, abort to get rid of the mysql participation inn this # first of all, abort to get rid of the mysql participation in this
# transaction # transaction
self.portal._p_jar.sync() self.portal._p_jar.sync()
......
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