BOM-618 Decode test client content.
The django test client returns bytes, and many of our tests start using it like a string. This was fine in python 2 but not in python3.
This commit is contained in:
@@ -30,7 +30,7 @@ class AjaxExceptionTestCase(TestCase):
|
||||
self.assertEqual(self.exception1.status_code, response1.status_code)
|
||||
self.assertEqual(
|
||||
{"errors": json.loads(text_type(self.exception1))},
|
||||
json.loads(response1.content)
|
||||
json.loads(response1.content.decode('utf-8'))
|
||||
)
|
||||
|
||||
response2 = self.a.process_exception(self.request1, self.exception2)
|
||||
@@ -38,7 +38,7 @@ class AjaxExceptionTestCase(TestCase):
|
||||
self.assertEqual(self.exception2.status_code, response2.status_code)
|
||||
self.assertEqual(
|
||||
{"errors": [text_type(self.exception2)]},
|
||||
json.loads(response2.content)
|
||||
json.loads(response2.content.decode('utf-8'))
|
||||
)
|
||||
|
||||
self.assertIsNone(self.a.process_exception(self.request1, self.exception0))
|
||||
|
||||
@@ -33,7 +33,7 @@ class TestDashboardError(unittest.TestCase):
|
||||
"""
|
||||
def test_response(self):
|
||||
error = tools.DashboardError(u'Oh noes!')
|
||||
response = json.loads(error.response().content)
|
||||
response = json.loads(error.response().content.decode('utf-8'))
|
||||
self.assertEqual(response, {'error': 'Oh noes!'})
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class TestHandleDashboardError(unittest.TestCase):
|
||||
"""
|
||||
raise tools.DashboardError("Oh noes!")
|
||||
|
||||
response = json.loads(view(None, None).content)
|
||||
response = json.loads(view(None, None).content.decode('utf-8'))
|
||||
self.assertEqual(response, {'error': 'Oh noes!'})
|
||||
|
||||
def test_no_error(self):
|
||||
|
||||
Reference in New Issue
Block a user