summaryrefslogtreecommitdiff
path: root/tests/auth_tests
diff options
context:
space:
mode:
authorMike Edmunds <medmunds@gmail.com>2024-12-23 15:01:36 -0800
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2025-07-25 13:50:02 +0200
commit9ab1991689000821a4d86b8617e1c1455a327482 (patch)
tree624568f098727dd672284aa01b7ec9a1c56946ed /tests/auth_tests
parent20c62199ffe0de1410083657a6d5bac799592210 (diff)
Fixed #35581 -- Updated django.core.mail to Python's modern email API.
- Changed EmailMessage.message() to construct a "modern email API" email.message.EmailMessage and added policy keyword arg. - Added support for modern MIMEPart objects in EmailMessage.attach() (and EmailMessage constructor, EmailMessage.attachments list). - Updated SMTP EmailBackend to use modern email.policy.SMTP. Deprecated: - Attaching MIMEBase objects (replace with MIMEPart) - BadHeaderError (modern email uses ValueError) - SafeMIMEText, SafeMIMEMultipart (unnecessary for modern email) - django.core.mail.forbid_multi_line_headers() (undocumented, but exposed via `__all__` and in wide use) - django.core.mail.message.sanitize_address() (undocumented, but in wide use) Removed without deprecation (all undocumented): - EmailMessage.mixed_subtype - EmailMultiAlternatives.alternative_subtype - Support for setting (undocumented) EmailMessage.encoding property to a legacy email.charset.Charset object Related changes: - Dropped tests for incorrect RFC 2047 encoding of non-ASCII email address localparts. This is specifically prohibited by RFC 2047, and not supported by any known MTA or email client. (Python still mis-applies encoded-word to non-ASCII localparts, but it is a bug that may be fixed in the future.) - Added tests that try to discourage using Python's legacy email APIs in future updates to django.core.mail.
Diffstat (limited to 'tests/auth_tests')
-rw-r--r--tests/auth_tests/test_forms.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/auth_tests/test_forms.py b/tests/auth_tests/test_forms.py
index 735ac1d237..be55c4369b 100644
--- a/tests/auth_tests/test_forms.py
+++ b/tests/auth_tests/test_forms.py
@@ -1367,13 +1367,13 @@ class PasswordResetFormTest(TestDataMixin, TestCase):
self.assertTrue(
re.match(
r"^http://example.com/reset/[\w/-]+",
- message.get_payload(0).get_payload(),
+ message.get_payload(0).get_content(),
)
)
self.assertTrue(
re.match(
r'^<html><a href="http://example.com/reset/[\w/-]+/">Link</a></html>$',
- message.get_payload(1).get_payload(),
+ message.get_payload(1).get_content(),
)
)