diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/regressiontests/test_client_regress/models.py | 4 | ||||
-rw-r--r-- | tests/regressiontests/test_client_regress/views.py | 7 |
2 files changed, 6 insertions, 5 deletions
diff --git a/tests/regressiontests/test_client_regress/models.py b/tests/regressiontests/test_client_regress/models.py index be2cb8fa37..b478100cff 100644 --- a/tests/regressiontests/test_client_regress/models.py +++ b/tests/regressiontests/test_client_regress/models.py @@ -648,7 +648,7 @@ class UnicodePayloadTests(TestCase): json = u'{"dog": "собака"}' response = self.client.post("/test_client_regress/parse_unicode_json/", json, content_type="application/json; charset=utf-16") - self.assertEqual(response.content, json.encode('utf-16')) + self.assertEqual(response.content, json.encode(settings.DEFAULT_CHARSET)) def test_unicode_payload_non_utf(self): "A non-ASCII unicode data as a non-UTF based encoding can be POSTed" @@ -656,4 +656,4 @@ class UnicodePayloadTests(TestCase): json = u'{"dog": "собака"}' response = self.client.post("/test_client_regress/parse_unicode_json/", json, content_type="application/json; charset=koi8-r") - self.assertEqual(response.content, json.encode('koi8-r')) + self.assertEqual(response.content, json.encode(settings.DEFAULT_CHARSET)) diff --git a/tests/regressiontests/test_client_regress/views.py b/tests/regressiontests/test_client_regress/views.py index 5ba7cc30a9..076c36fc3b 100644 --- a/tests/regressiontests/test_client_regress/views.py +++ b/tests/regressiontests/test_client_regress/views.py @@ -79,10 +79,11 @@ def return_json_file(request): # This just checks that the uploaded data is JSON obj_dict = simplejson.loads(request.raw_post_data.decode(charset)) - obj_json = simplejson.dumps(obj_dict, encoding=charset, + obj_json = simplejson.dumps(obj_dict, encoding=settings.DEFAULT_CHARSET, cls=DjangoJSONEncoder, ensure_ascii=False) - response = HttpResponse(smart_str(obj_json, encoding=charset), status=200, - mimetype='application/json; charset=' + charset) + + response = HttpResponse(smart_str(obj_json), status=200, + mimetype='application/json') response['Content-Disposition'] = 'attachment; filename=testfile.json' return response |