summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVinay Karanam <vinayinvicible@gmail.com>2016-11-16 18:52:38 +0530
committerTim Graham <timograham@gmail.com>2016-12-07 08:28:46 -0500
commit4a246a02bdcbc13b15480c014f51cb0682af7c1e (patch)
treeeebd27f89e806db66f5344b63d63c574578b5697 /tests
parent183f5015408ffe0d3a22203ddaf7a3a56da025fd (diff)
Refs #17235 -- Made MultiPartParser leave request.POST immutable.
Diffstat (limited to 'tests')
-rw-r--r--tests/requests/tests.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/requests/tests.py b/tests/requests/tests.py
index 0942619715..27dc439e5f 100644
--- a/tests/requests/tests.py
+++ b/tests/requests/tests.py
@@ -533,6 +533,25 @@ class RequestsTests(SimpleTestCase):
self.assertEqual(request.read(13), b'--boundary\r\nC')
self.assertEqual(request.POST, {'name': ['value']})
+ def test_POST_immutable_for_mutipart(self):
+ """
+ MultiPartParser.parse() leaves request.POST immutable.
+ """
+ payload = FakePayload("\r\n".join([
+ '--boundary',
+ 'Content-Disposition: form-data; name="name"',
+ '',
+ 'value',
+ '--boundary--',
+ ]))
+ request = WSGIRequest({
+ 'REQUEST_METHOD': 'POST',
+ 'CONTENT_TYPE': 'multipart/form-data; boundary=boundary',
+ 'CONTENT_LENGTH': len(payload),
+ 'wsgi.input': payload,
+ })
+ self.assertFalse(request.POST._mutable)
+
def test_POST_connection_error(self):
"""
If wsgi.input.read() raises an exception while trying to read() the