fix webapp tests for py3

- urllib returns bytes, json wants str
- webob py3 requires charset

Change-Id: I05fbbadc991ab6754c224e6b2ca69848e8414af6
diff --git a/tests/unit/test_webapp.py b/tests/unit/test_webapp.py
index 4511ec7..b2836ae 100644
--- a/tests/unit/test_webapp.py
+++ b/tests/unit/test_webapp.py
@@ -51,7 +51,7 @@
         req = urllib.request.Request(
             "http://localhost:%s/tenant-one/status" % self.port)
         f = urllib.request.urlopen(req)
-        data = json.loads(f.read())
+        data = json.loads(f.read().decode('utf8'))
 
         self.assertIn('pipelines', data)
 
@@ -60,7 +60,7 @@
         req = urllib.request.Request(
             "http://localhost:%s/tenant-one/status.json" % self.port)
         f = urllib.request.urlopen(req)
-        data = json.loads(f.read())
+        data = json.loads(f.read().decode('utf8'))
 
         self.assertIn('pipelines', data)
 
@@ -75,7 +75,7 @@
         req = urllib.request.Request(
             "http://localhost:%s/tenant-one/status/change/1,1" % self.port)
         f = urllib.request.urlopen(req)
-        data = json.loads(f.read())
+        data = json.loads(f.read().decode('utf8'))
 
         self.assertEqual(1, len(data), data)
         self.assertEqual("org/project", data[0]['project'])
@@ -83,13 +83,13 @@
         req = urllib.request.Request(
             "http://localhost:%s/tenant-one/status/change/2,1" % self.port)
         f = urllib.request.urlopen(req)
-        data = json.loads(f.read())
+        data = json.loads(f.read().decode('utf8'))
 
         self.assertEqual(1, len(data), data)
         self.assertEqual("org/project1", data[0]['project'], data)
 
     def test_webapp_keys(self):
-        with open(os.path.join(FIXTURE_DIR, 'public.pem')) as f:
+        with open(os.path.join(FIXTURE_DIR, 'public.pem'), 'rb') as f:
             public_pem = f.read()
 
         req = urllib.request.Request(
@@ -106,7 +106,7 @@
         req = urllib.request.Request(
             "http://localhost:%s/custom" % self.port)
         f = urllib.request.urlopen(req)
-        self.assertEqual('ok', f.read())
+        self.assertEqual(b'ok', f.read())
 
         self.webapp.unregister_path('/custom')
         self.assertRaises(urllib.error.HTTPError, urllib.request.urlopen, req)
diff --git a/zuul/webapp.py b/zuul/webapp.py
index 9c7d057..e4feaa0 100644
--- a/zuul/webapp.py
+++ b/zuul/webapp.py
@@ -147,7 +147,8 @@
     def status(self, path, tenant_name, request):
         def func():
             return webob.Response(body=self.cache[tenant_name],
-                                  content_type='application/json')
+                                  content_type='application/json',
+                                  charset='utf8')
         return self._response_with_status_cache(func, tenant_name)
 
     def change(self, path, tenant_name, request):
@@ -157,7 +158,8 @@
             status = self._status_for_change(change_id, tenant_name)
             if status:
                 return webob.Response(body=status,
-                                      content_type='application/json')
+                                      content_type='application/json',
+                                      charset='utf8')
             else:
                 raise webob.exc.HTTPNotFound()
         return self._response_with_status_cache(func, tenant_name)