Skip to content

Commit

Permalink
fixed tests for python 3.
Browse files Browse the repository at this point in the history
  • Loading branch information
dhedegaard committed Jun 23, 2015
1 parent a50ac59 commit aead097
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions webchat/tests.py
Expand Up @@ -36,15 +36,15 @@ def test_send__invalid(self):
'username': 'testuser',
})
self.assertEqual(resp.status_code, 400)
jsonresp = json.loads(resp.content)
jsonresp = json.loads(resp.content.decode())
self.assertTrue('message' in jsonresp)
self.assertEqual(len(jsonresp['message']), 1)
self.assertEqual(jsonresp['message'][0]['code'], 'required')

def test_get_new__invalid(self):
resp = self.client.post(reverse('get_new'))
self.assertEqual(resp.status_code, 400)
jsonresp = json.loads(resp.content)
jsonresp = json.loads(resp.content.decode())
self.assertTrue('id' in jsonresp)
self.assertEqual(len(jsonresp['id']), 1)
self.assertEqual(jsonresp['id'][0]['code'], 'required')
Expand All @@ -55,7 +55,7 @@ def test_get_new__non_existant(self, time_patch):
'id': 0,
})
self.assertEqual(resp.status_code, 200)
self.assertEqual(resp.content, 'OK')
self.assertEqual(resp.content, b'OK')
self.assertEqual(resp['Content-Type'], 'text/plain')
self.assertTrue(time_patch.sleep.called)

Expand All @@ -69,7 +69,7 @@ def test_get_new__new_message(self):
})
self.assertEqual(resp.status_code, 200)
self.assertEqual(resp['Content-Type'], 'application/json')
jsonresp = json.loads(resp.content)
jsonresp = json.loads(resp.content.decode())
self.assertEqual(jsonresp['lastid'], msg.pk)
self.assertEqual(len(jsonresp['messages']), 1)
self.assertEqual(jsonresp['messages'][0]['id'], msg.pk)
Expand Down

0 comments on commit aead097

Please sign in to comment.