[devtools] CubicWebTC._check_html may have to deal with unicode or bytes
authorJulien Cristau <julien.cristau@logilab.fr>
Thu, 01 Oct 2015 12:15:14 +0200
changeset 10755 4c48d3bab38c
parent 10754 03aa9f2a4ecb
child 10756 3eb527ce5f0f
[devtools] CubicWebTC._check_html may have to deal with unicode or bytes If called with template=None, CubicWebTC.view will not go through main-template, and return the unicode data from the view directly instead of encoded data.
devtools/testlib.py
--- a/devtools/testlib.py	Thu Oct 01 12:02:02 2015 +0200
+++ b/devtools/testlib.py	Thu Oct 01 12:15:14 2015 +0200
@@ -981,6 +981,9 @@
     def _check_html(self, output, view, template='main-template'):
         """raises an exception if the HTML is invalid"""
         output = output.strip()
+        if isinstance(output, text_type):
+            # XXX
+            output = output.encode('utf-8')
         validator = self.get_validator(view, output=output)
         if validator is None:
             return output # return raw output if no validator is defined