[web/test] switch unittest_web from twisted to wsgi
authorJulien Cristau <julien.cristau@logilab.fr>
Mon, 08 Feb 2016 16:10:51 +0100
changeset 11159 b07406dae25e
parent 11158 669eac69ea21
child 11160 ed048bfd1b88
[web/test] switch unittest_web from twisted to wsgi And make it pass on python3 while at it.
cubicweb/web/test/unittest_web.py
--- a/cubicweb/web/test/unittest_web.py	Wed Feb 24 17:31:56 2016 +0100
+++ b/cubicweb/web/test/unittest_web.py	Mon Feb 08 16:10:51 2016 +0100
@@ -28,7 +28,7 @@
     requests = None
 
 from logilab.common.testlib import TestCase, unittest_main
-from cubicweb.devtools.httptest import CubicWebServerTC
+from cubicweb.devtools.httptest import CubicWebWsgiTC
 from cubicweb.devtools.fake import FakeRequest
 
 class AjaxReplaceUrlTC(TestCase):
@@ -56,7 +56,7 @@
             req.html_headers.post_inlined_scripts[0])
 
 
-class FileUploadTC(CubicWebServerTC):
+class FileUploadTC(CubicWebWsgiTC):
 
     def setUp(self):
         "Skip whole test class if a suitable requests module is not available"
@@ -101,17 +101,17 @@
         self.assertDictEqual(expect, loads(webreq.text))
 
 
-class LanguageTC(CubicWebServerTC):
+class LanguageTC(CubicWebWsgiTC):
 
     def test_language_neg(self):
         headers = {'Accept-Language': 'fr'}
         webreq = self.web_request(headers=headers)
-        self.assertIn('lang="fr"', webreq.read())
+        self.assertIn(b'lang="fr"', webreq.read())
         vary = [h.lower().strip() for h in webreq.getheader('Vary').split(',')]
         self.assertIn('accept-language', vary)
         headers = {'Accept-Language': 'en'}
         webreq = self.web_request(headers=headers)
-        self.assertIn('lang="en"', webreq.read())
+        self.assertIn(b'lang="en"', webreq.read())
         vary = [h.lower().strip() for h in webreq.getheader('Vary').split(',')]
         self.assertIn('accept-language', vary)
 
@@ -132,7 +132,7 @@
         self.assertIn('HttpOnly', webreq.getheader('set-cookie'))
 
 
-class MiscOptionsTC(CubicWebServerTC):
+class MiscOptionsTC(CubicWebWsgiTC):
     @classmethod
     def setUpClass(cls):
         super(MiscOptionsTC, cls).setUpClass()
@@ -151,7 +151,7 @@
 
     def test_datadir_url(self):
         webreq = self.web_request()
-        self.assertNotIn('/data/', webreq.read())
+        self.assertNotIn(b'/data/', webreq.read())
 
     @classmethod
     def tearDownClass(cls):