Fix Py3 encoding failures in tests.py.

This commit is contained in:
Dave Shawley 2014-11-18 13:47:29 -05:00
parent f3674bf273
commit 0e6f9431ec

View file

@ -46,7 +46,7 @@ class TestHTTPError(testing.AsyncHTTPTestCase):
def test_tornado_thrown_exception(self): def test_tornado_thrown_exception(self):
response = self.fetch('/') response = self.fetch('/')
expected = {'message': 'Unexpected Error', 'type': 'Bad Request'} expected = {'message': 'Unexpected Error', 'type': 'Bad Request'}
self.assertEqual(json.loads(response.body), expected) self.assertEqual(json.loads(response.body.decode('utf-8')), expected)
class TestCustomExceptions(testing.AsyncHTTPTestCase): class TestCustomExceptions(testing.AsyncHTTPTestCase):
@ -61,7 +61,7 @@ class TestCustomExceptions(testing.AsyncHTTPTestCase):
'type': 'FailureError', 'type': 'FailureError',
'documentation_url': 'http://www.example.com', 'documentation_url': 'http://www.example.com',
} }
self.assertEqual(json.loads(response.body), expected) self.assertEqual(json.loads(response.body.decode('utf-8')), expected)
class TestUnexpectedError(testing.AsyncHTTPTestCase): class TestUnexpectedError(testing.AsyncHTTPTestCase):
@ -75,4 +75,4 @@ class TestUnexpectedError(testing.AsyncHTTPTestCase):
'message': 'Unexpected Error', 'message': 'Unexpected Error',
'type': 'Internal Server Error' 'type': 'Internal Server Error'
} }
self.assertEqual(json.loads(response.body), expected) self.assertEqual(json.loads(response.body.decode('utf-8')), expected)