Created
March 7, 2017 16:14
-
-
Save claudep/133ed167be5b3d85013812a8a385555b to your computer and use it in GitHub Desktop.
Test for #27895
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/tests/test_client_regress/tests.py b/tests/test_client_regress/tests.py | |
index c9dffdb..0233786 100644 | |
--- a/tests/test_client_regress/tests.py | |
+++ b/tests/test_client_regress/tests.py | |
@@ -1200,6 +1200,21 @@ class RequestMethodStringDataTests(SimpleTestCase): | |
response = self.client.get('/json_response/') | |
self.assertEqual(response.json(), {'key': 'value'}) | |
+ def test_json_non_ascii(self): | |
+ """Test with both escaped and non-escaped UTF-8 content.""" | |
+ response = self.client.post( | |
+ '/parse_unicode_json/', | |
+ '{"dog": "собака"}', | |
+ content_type="application/json; charset=utf-8", | |
+ ) | |
+ self.assertEqual(response.json(), {"dog": "собака"}) | |
+ response = self.client.post( | |
+ '/parse_unicode_json/', | |
+ '{"dog": "\\u0441\\u043e\\u0431\\u0430\\u043a\\u0430"}', | |
+ content_type="application/json; charset=utf-8", | |
+ ) | |
+ self.assertEqual(response.json(), {"dog": "собака"}) | |
+ | |
def test_json_vendor(self): | |
valid_types = ( | |
'application/vnd.api+json', |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment