MCPcopy
hub / github.com/django/django / test_header_injection

Method test_header_injection

tests/mail/tests.py:455–466  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

453 EmailMessage(**params)
454
455 def test_header_injection(self):
456 msg = "Header values may not contain linefeed or carriage return characters"
457 cases = [
458 {"subject": "Subject\nInjection Test"},
459 {"subject": gettext_lazy("Lazy Subject\nInjection Test")},
460 {"to": ["Name\nInjection test <to@example.com>"]},
461 ]
462 for kwargs in cases:
463 with self.subTest(case=kwargs):
464 email = EmailMessage(**kwargs)
465 with self.assertRaisesMessage(ValueError, msg):
466 email.message()
467
468 def test_folding_white_space(self):
469 """

Callers

nothing calls this directly

Calls 3

messageMethod · 0.95
EmailMessageClass · 0.90
assertRaisesMessageMethod · 0.80

Tested by

no test coverage detected