MCPcopy
hub / github.com/django/django / test_idn_addresses

Method test_idn_addresses

tests/mail/tests.py:1455–1470  ·  view source on GitHub ↗

IDNA encoding is applied to non-ASCII domains in address headers (#14301). See also test_address_header_handling() for several variations in the to field.

(self)

Source from the content-addressed store, hash-verified

1453 email.message()
1454
1455 def test_idn_addresses(self):
1456 """
1457 IDNA encoding is applied to non-ASCII domains in address headers
1458 (#14301).
1459
1460 See also test_address_header_handling() for several variations in the
1461 to field.
1462 """
1463 email = EmailMessage(
1464 from_email="from@öäü.com", to=["to@öäü.com"], cc=["cc@öäü.com"]
1465 )
1466 email.send()
1467 message = self.get_outbox_message()
1468 self.assertEqual(message.get("from"), "from@xn--4ca9at.com")
1469 self.assertEqual(message.get("to"), "to@xn--4ca9at.com")
1470 self.assertEqual(message.get("cc"), "cc@xn--4ca9at.com")
1471
1472 def test_localpart_only_address(self):
1473 """

Callers

nothing calls this directly

Calls 4

sendMethod · 0.95
EmailMessageClass · 0.90
get_outbox_messageMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected