MCPcopy
hub / github.com/django/django / test_basic

Method test_basic

tests/utils_tests/test_http.py:571–593  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

569
570class ContentDispositionHeaderTests(unittest.TestCase):
571 def test_basic(self):
572 tests = (
573 ((False, None), None),
574 ((False, "example"), 'inline; filename="example"'),
575 ((True, None), "attachment"),
576 ((True, "example"), 'attachment; filename="example"'),
577 (
578 (True, '"example" file\\name'),
579 'attachment; filename="\\"example\\" file\\\\name"',
580 ),
581 ((True, "espécimen"), "attachment; filename*=utf-8''esp%C3%A9cimen"),
582 (
583 (True, '"espécimen" filename'),
584 "attachment; filename*=utf-8''%22esp%C3%A9cimen%22%20filename",
585 ),
586 ((True, "some\nfile"), "attachment; filename*=utf-8''some%0Afile"),
587 )
588
589 for (is_attachment, filename), expected in tests:
590 with self.subTest(is_attachment=is_attachment, filename=filename):
591 self.assertEqual(
592 content_disposition_header(is_attachment, filename), expected
593 )

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected