Commit c9dab325 authored by Michal Čihař's avatar Michal Čihař

Fix JS views tests with Python 3

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 1ecb254c
...@@ -51,7 +51,10 @@ class JSViewsTest(ViewTestCase): ...@@ -51,7 +51,10 @@ class JSViewsTest(ViewTestCase):
reverse('js-get', kwargs={'unit_id': unit.id}), reverse('js-get', kwargs={'unit_id': unit.id}),
) )
self.assertContains(response, 'Hello') self.assertContains(response, 'Hello')
self.assertEqual(response.content, unit.get_source_plurals()[0]) self.assertEqual(
unit.get_source_plurals()[0],
response.content.decode('utf-8')
)
response = self.client.get( response = self.client.get(
reverse('js-get', kwargs={'unit_id': 0}), reverse('js-get', kwargs={'unit_id': 0}),
...@@ -77,7 +80,7 @@ class JSViewsTest(ViewTestCase): ...@@ -77,7 +80,7 @@ class JSViewsTest(ViewTestCase):
{'service': 'dummy'} {'service': 'dummy'}
) )
self.assertContains(response, 'Ahoj') self.assertContains(response, 'Ahoj')
data = json.loads(response.content) data = json.loads(response.content.decode('utf-8'))
self.assertEqual( self.assertEqual(
data['translations'], data['translations'],
[ [
...@@ -114,6 +117,6 @@ class JSViewsTest(ViewTestCase): ...@@ -114,6 +117,6 @@ class JSViewsTest(ViewTestCase):
self.ensure_dummy_mt() self.ensure_dummy_mt()
response = self.client.get(reverse('js-mt-services')) response = self.client.get(reverse('js-mt-services'))
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
data = json.loads(response.content) data = json.loads(response.content.decode('utf-8'))
# Check we have dummy service listed # Check we have dummy service listed
self.assertIn('dummy', data) self.assertIn('dummy', data)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment