summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2012-08-15 10:57:05 +0200
committerClaude Paroz <claude@2xlibre.net>2012-08-15 10:58:26 +0200
commite0d67f3440b3b2c854da013fd1f9894477e26a77 (patch)
treedd859b35e432c62b1df02c46b3c01dd1065c2bff /tests
parent64531df5df1fdb93af4eebaa7994716d6cd5b15f (diff)
[py3] Fixed test_client_regress tests
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/test_client_regress/tests.py4
-rw-r--r--tests/regressiontests/test_client_regress/views.py4
2 files changed, 3 insertions, 5 deletions
diff --git a/tests/regressiontests/test_client_regress/tests.py b/tests/regressiontests/test_client_regress/tests.py
index 59f8f423dd..d80293b358 100644
--- a/tests/regressiontests/test_client_regress/tests.py
+++ b/tests/regressiontests/test_client_regress/tests.py
@@ -858,7 +858,7 @@ class UnicodePayloadTests(TestCase):
json = '{"english": "mountain pass"}'
response = self.client.post("/test_client_regress/parse_unicode_json/", json,
content_type="application/json")
- self.assertEqual(response.content, json)
+ self.assertEqual(response.content, json.encode())
def test_unicode_payload_utf8(self):
"A non-ASCII unicode data encoded as UTF-8 can be POSTed"
@@ -888,7 +888,7 @@ class DummyFile(object):
def __init__(self, filename):
self.name = filename
def read(self):
- return 'TEST_FILE_CONTENT'
+ return b'TEST_FILE_CONTENT'
class UploadedFileEncodingTest(TestCase):
def test_file_encoding(self):
diff --git a/tests/regressiontests/test_client_regress/views.py b/tests/regressiontests/test_client_regress/views.py
index 8792a97dc0..9b0654806b 100644
--- a/tests/regressiontests/test_client_regress/views.py
+++ b/tests/regressiontests/test_client_regress/views.py
@@ -80,9 +80,7 @@ def return_json_file(request):
# This just checks that the uploaded data is JSON
obj_dict = json.loads(request.body.decode(charset))
- obj_json = json.dumps(obj_dict, encoding=charset,
- cls=DjangoJSONEncoder,
- ensure_ascii=False)
+ obj_json = json.dumps(obj_dict, cls=DjangoJSONEncoder, ensure_ascii=False)
response = HttpResponse(obj_json.encode(charset), status=200,
content_type='application/json; charset=%s' % charset)
response['Content-Disposition'] = 'attachment; filename=testfile.json'