[py3k] PageInfo.source contains bytes
authorRémi Cardona <remi.cardona@logilab.fr>
Tue, 22 Sep 2015 10:24:47 +0200
changeset 10726 bb91f581c389
parent 10725 1776c94a74e8
child 10727 3fb9111d521f
[py3k] PageInfo.source contains bytes
web/test/test_views.py
web/test/unittest_views_baseviews.py
--- a/web/test/test_views.py	Mon Sep 21 18:58:12 2015 +0200
+++ b/web/test/test_views.py	Tue Sep 22 10:24:47 2015 +0200
@@ -57,12 +57,12 @@
         with self.admin_access.web_request() as req:
             # sortable.js should not be included by default
             rset = req.execute('CWUser X')
-            self.assertNotIn('jquery.tablesorter.js', self.view('oneline', rset, req=req).source)
+            self.assertNotIn(b'jquery.tablesorter.js', self.view('oneline', rset, req=req).source)
 
         with self.admin_access.web_request() as req:
             # but should be included by the tableview
             rset = req.execute('Any P,F,S LIMIT 1 WHERE P is CWUser, P firstname F, P surname S')
-            self.assertIn('jquery.tablesorter.js', self.view('table', rset, req=req).source)
+            self.assertIn(b'jquery.tablesorter.js', self.view('table', rset, req=req).source)
 
     def test_js_added_only_once(self):
         with self.admin_access.web_request() as req:
@@ -70,7 +70,7 @@
             self.vreg.register(SomeView)
             rset = req.execute('CWUser X')
             source = self.view('someview', rset, req=req).source
-            self.assertEqual(source.count('spam.js'), 1)
+            self.assertEqual(source.count(b'spam.js'), 1)
 
     def test_unrelateddivs(self):
         with self.admin_access.client_cnx() as cnx:
--- a/web/test/unittest_views_baseviews.py	Mon Sep 21 18:58:12 2015 +0200
+++ b/web/test/unittest_views_baseviews.py	Tue Sep 22 10:24:47 2015 +0200
@@ -129,8 +129,8 @@
                 source_lines = [line.strip()
                                 for line in html_source.splitlines(False)
                                 if line.strip()]
-                self.assertListEqual(['<!DOCTYPE html>',
-                                      '<html xmlns:cubicweb="http://www.cubicweb.org" lang="en">'],
+                self.assertListEqual([b'<!DOCTYPE html>',
+                                      b'<html xmlns:cubicweb="http://www.cubicweb.org" lang="en">'],
                                      source_lines[:2])
 
     def test_set_doctype_no_reset_xmldecl(self):
@@ -151,9 +151,9 @@
                 source_lines = [line.strip()
                                 for line in html_source.splitlines(False)
                                 if line.strip()]
-                self.assertListEqual([html_doctype,
-                                      '<html xmlns:cubicweb="http://www.cubicweb.org" lang="cz">',
-                                      '<head>'],
+                self.assertListEqual([html_doctype.encode('ascii'),
+                                      b'<html xmlns:cubicweb="http://www.cubicweb.org" lang="cz">',
+                                      b'<head>'],
                                      source_lines[:3])
 
 if __name__ == '__main__':