summaryrefslogtreecommitdiff
path: root/tests/regressiontests/requests
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2012-11-03 12:54:06 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2012-11-03 13:07:02 +0100
commitb99707bdedbcbf832bd88eaefd488c841110a222 (patch)
tree6e963f4a064d22b245f05303ca42638dae647558 /tests/regressiontests/requests
parentf12fa7750c95cafa3a317be6a62ed3a2f53caf3c (diff)
[1.5.x] Fixed #19101 -- Decoding of non-ASCII POST data on Python 3.
Thanks Claude Paroz. Backport of 095eca8 from master.
Diffstat (limited to 'tests/regressiontests/requests')
-rw-r--r--tests/regressiontests/requests/tests.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/regressiontests/requests/tests.py b/tests/regressiontests/requests/tests.py
index eaf25ea7a6..164c1082fe 100644
--- a/tests/regressiontests/requests/tests.py
+++ b/tests/regressiontests/requests/tests.py
@@ -12,7 +12,7 @@ from django.http import HttpRequest, HttpResponse, parse_cookie, build_request_r
from django.test.client import FakePayload
from django.test.utils import override_settings, str_prefix
from django.utils import unittest
-from django.utils.http import cookie_date
+from django.utils.http import cookie_date, urlencode
from django.utils.timezone import utc
@@ -353,6 +353,16 @@ class RequestsTests(unittest.TestCase):
self.assertRaises(Exception, lambda: request.body)
self.assertEqual(request.POST, {})
+ def test_non_ascii_POST(self):
+ payload = FakePayload(urlencode({'key': 'España'}))
+ request = WSGIRequest({
+ 'REQUEST_METHOD': 'POST',
+ 'CONTENT_LENGTH': len(payload),
+ 'CONTENT_TYPE': 'application/x-www-form-urlencoded',
+ 'wsgi.input': payload,
+ })
+ self.assertEqual(request.POST, {'key': ['España']})
+
def test_alternate_charset_POST(self):
"""
Test a POST with non-utf-8 payload encoding.