diff wiki/tests/test_middleware.py @ 1174:ba3230aba90c

Fix unicode error with wiki cookie processing
author Brian Neal <bgneal@gmail.com>
date Thu, 07 Jun 2018 19:53:13 -0500
parents 3782fa705821
children
line wrap: on
line diff
--- a/wiki/tests/test_middleware.py	Sat Apr 14 14:03:04 2018 -0500
+++ b/wiki/tests/test_middleware.py	Thu Jun 07 19:53:13 2018 -0500
@@ -1,3 +1,4 @@
+# coding=utf-8
 """
 Tests for the wiki integration application.
 
@@ -20,8 +21,8 @@
 
     def setUp(self):
         self.factory = RequestFactory()
-        self.user = User.objects.create_user('test_user', 'test@example.com',
-                'password')
+        self.user = User.objects.create_user(u'Sérgio', u'test@example.com',
+                u'password')
         self.conn = get_redis_connection()
         self.mw = WikiMiddleware()
 
@@ -52,7 +53,7 @@
 
             cookie_val = cookie.value
             try:
-                user, email, key = cookie_val.split('#')
+                user, email, key = cookie_val.decode('utf-8').split('#')
             except ValueError:
                 self.fail('invalid cookie value')
             else: