[Tests] json loads Python 3.5 compatible

json.loads in Python 3.6 accepts str or bytes but Python 3.5 is str
only so decode.
This commit is contained in:
Calum Lind 2018-10-09 12:39:09 +01:00
parent 86d582d52a
commit 4a335eeb61
2 changed files with 3 additions and 3 deletions

View File

@ -86,7 +86,7 @@ class JSONTestCase(JSONBase):
def write(response_str):
request.write_was_called = True
response = json_lib.loads(response_str)
response = json_lib.loads(response_str.decode())
self.assertEqual(response['result'], None)
self.assertEqual(response['id'], None)
self.assertEqual(
@ -271,7 +271,7 @@ class JSONRequestFailedTestCase(JSONBase, WebServerMockBase):
def write(response_str):
request.write_was_called = True
response = json_lib.loads(response_str)
response = json_lib.loads(response_str.decode())
self.assertEqual(response['result'], None, 'BAD RESULT')
self.assertEqual(response['id'], 0)
self.assertEqual(

View File

@ -55,6 +55,6 @@ class WebServerTestCase(WebServerTestBase, WebServerMockBase):
body = yield twisted.web.client.readBody(d)
json = json_lib.loads(body)
json = json_lib.loads(body.decode())
self.assertEqual(None, json['error'])
self.assertEqual('torrent_filehash', json['result']['name'])