[Checkins] SVN: five.pt/trunk/src/five/pt/tests/test_persistenttemplate.py add test for editing templates with errors
Leonardo Rochael Almeida
leorochael at gmail.com
Tue Aug 9 06:27:10 EDT 2011
Log message for revision 122496:
add test for editing templates with errors
Changed:
U five.pt/trunk/src/five/pt/tests/test_persistenttemplate.py
-=-
Modified: five.pt/trunk/src/five/pt/tests/test_persistenttemplate.py
===================================================================
--- five.pt/trunk/src/five/pt/tests/test_persistenttemplate.py 2011-08-09 10:26:25 UTC (rev 122495)
+++ five.pt/trunk/src/five/pt/tests/test_persistenttemplate.py 2011-08-09 10:27:10 UTC (rev 122496)
@@ -40,6 +40,12 @@
</tal:block>
""".strip()
+simple_error = """
+<tal:block define="foo python: 0 < 1">
+ putting a "less-than" inside an attribute value is not valid
+</tal:block>
+""".strip()
+
repeat_object = """
<tal:loop repeat="counter python: range(3)"
content="python: repeat['counter'].index" />
@@ -171,3 +177,15 @@
# this should still work, without trying to open some random
# file on the filesystem
self.assertEqual(template().strip().split(), u'0 1 2'.split())
+
+ def test_edit_with_errors(self):
+ from zope.pagetemplate.pagetemplate import _error_start
+ template = self._makeOne('foo', simple_error)
+ # this should not raise:
+ editable_text = get_editable_content(template)
+ # and the errors should be in an xml comment at the start of
+ # the editable text
+ error_prefix = cgi.escape(
+ '%s\n %s\n-->\n' % (_error_start, '\n '.join(template._v_errors))
+ )
+ self.assertTrue(editable_text.startswith(error_prefix))
More information about the checkins
mailing list