MCPcopy
hub / github.com/django/django / test_datetime_in_date_header

Method test_datetime_in_date_header

tests/mail/tests.py:500–511  ·  view source on GitHub ↗

A datetime in headers should be passed through to Python email intact, so that it uses the email header date format.

(self)

Source from the content-addressed store, hash-verified

498 )
499
500 def test_datetime_in_date_header(self):
501 """
502 A datetime in headers should be passed through to Python email intact,
503 so that it uses the email header date format.
504 """
505 email = EmailMessage(
506 headers={"Date": datetime(2001, 11, 9, 1, 8, 47, tzinfo=timezone.utc)},
507 )
508 message = email.message()
509 self.assertEqual(message["Date"], "Fri, 09 Nov 2001 01:08:47 +0000")
510 # Not the default ISO format from force_str(strings_only=False).
511 self.assertNotEqual(message["Date"], "2001-11-09 01:08:47+00:00")
512
513 @requires_tz_support
514 @override_settings(

Callers

nothing calls this directly

Calls 2

messageMethod · 0.95
EmailMessageClass · 0.90

Tested by

no test coverage detected