summaryrefslogtreecommitdiff
path: root/tests/file_uploads
diff options
context:
space:
mode:
authorMehrdad <mhrddmoradii@gmail.com>2022-06-24 14:46:34 -0400
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-06-28 09:42:47 +0200
commitd4d5427571b4bf3a21c902276c2a00215c2a37cc (patch)
tree59cc1bc214b414636b57b0e61fc6515a6e528f5f /tests/file_uploads
parentbff5c114be2b7a3fbc735c232abcc6ad4db89a9d (diff)
downloaddjango-d4d5427571b4bf3a21c902276c2a00215c2a37cc.tar.gz
Refs #33697 -- Used django.utils.http.parse_header_parameters() for parsing boundary streams.
This also removes unused parse_header() and _parse_header_params() helpers in django.http.multipartparser.
Diffstat (limited to 'tests/file_uploads')
-rw-r--r--tests/file_uploads/tests.py45
1 files changed, 0 insertions, 45 deletions
diff --git a/tests/file_uploads/tests.py b/tests/file_uploads/tests.py
index 44c54d908e..c6d76aa4c9 100644
--- a/tests/file_uploads/tests.py
+++ b/tests/file_uploads/tests.py
@@ -17,7 +17,6 @@ from django.http.multipartparser import (
MultiPartParser,
MultiPartParserError,
Parser,
- parse_header,
)
from django.test import SimpleTestCase, TestCase, client, override_settings
@@ -906,47 +905,3 @@ class MultiParserTests(SimpleTestCase):
for file_name in CANDIDATE_INVALID_FILE_NAMES:
with self.subTest(file_name=file_name):
self.assertIsNone(parser.sanitize_file_name(file_name))
-
- def test_rfc2231_parsing(self):
- test_data = (
- (
- b"Content-Type: application/x-stuff; "
- b"title*=us-ascii'en-us'This%20is%20%2A%2A%2Afun%2A%2A%2A",
- "This is ***fun***",
- ),
- (
- b"Content-Type: application/x-stuff; title*=UTF-8''foo-%c3%a4.html",
- "foo-ä.html",
- ),
- (
- b"Content-Type: application/x-stuff; title*=iso-8859-1''foo-%E4.html",
- "foo-ä.html",
- ),
- )
- for raw_line, expected_title in test_data:
- parsed = parse_header(raw_line)
- self.assertEqual(parsed[1]["title"], expected_title)
-
- def test_rfc2231_wrong_title(self):
- """
- Test wrongly formatted RFC 2231 headers (missing double single quotes).
- Parsing should not crash (#24209).
- """
- test_data = (
- (
- b"Content-Type: application/x-stuff; "
- b"title*='This%20is%20%2A%2A%2Afun%2A%2A%2A",
- b"'This%20is%20%2A%2A%2Afun%2A%2A%2A",
- ),
- (b"Content-Type: application/x-stuff; title*='foo.html", b"'foo.html"),
- (b"Content-Type: application/x-stuff; title*=bar.html", b"bar.html"),
- )
- for raw_line, expected_title in test_data:
- parsed = parse_header(raw_line)
- self.assertEqual(parsed[1]["title"], expected_title)
-
- def test_parse_header_with_double_quotes_and_semicolon(self):
- self.assertEqual(
- parse_header(b'form-data; name="files"; filename="fo\\"o;bar"'),
- ("form-data", {"name": b"files", "filename": b'fo"o;bar'}),
- )