forked from django/django
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed #35033, Refs #28912 -- Fixed repeated headers in EmailMessage.
Fixed a regression which would cause multiple To, Cc, and Reply-To headers in the result of EmailMessage.message() if values were supplied for both to/cc/reply_to and the corresponding extra_headers fields. Updated related tests to check the generated message() has exactly one of each expected header using get_all(). Regression in b03d500.
- Loading branch information
1 parent
c6d1f98
commit b909853
Showing
2 changed files
with
19 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -223,7 +223,7 @@ def test_cc_headers(self): | |
cc=["[email protected]"], | ||
headers={"Cc": "[email protected]"}, | ||
).message() | ||
self.assertEqual(message["Cc"], "[email protected]") | ||
self.assertEqual(message.get_all("Cc"), ["[email protected]"]) | ||
|
||
def test_cc_in_headers_only(self): | ||
message = EmailMessage( | ||
|
@@ -233,7 +233,7 @@ def test_cc_in_headers_only(self): | |
["[email protected]"], | ||
headers={"Cc": "[email protected]"}, | ||
).message() | ||
self.assertEqual(message["Cc"], "[email protected]") | ||
self.assertEqual(message.get_all("Cc"), ["[email protected]"]) | ||
|
||
def test_reply_to(self): | ||
email = EmailMessage( | ||
|
@@ -379,7 +379,7 @@ def test_from_header(self): | |
headers={"From": "[email protected]"}, | ||
) | ||
message = email.message() | ||
self.assertEqual(message["From"], "[email protected]") | ||
self.assertEqual(message.get_all("From"), ["[email protected]"]) | ||
|
||
def test_to_header(self): | ||
""" | ||
|
@@ -393,7 +393,7 @@ def test_to_header(self): | |
headers={"To": "[email protected]"}, | ||
) | ||
message = email.message() | ||
self.assertEqual(message["To"], "[email protected]") | ||
self.assertEqual(message.get_all("To"), ["[email protected]"]) | ||
self.assertEqual( | ||
email.to, ["[email protected]", "[email protected]"] | ||
) | ||
|
@@ -408,7 +408,8 @@ def test_to_header(self): | |
) | ||
message = email.message() | ||
self.assertEqual( | ||
message["To"], "[email protected], [email protected]" | ||
message.get_all("To"), | ||
["[email protected], [email protected]"], | ||
) | ||
self.assertEqual( | ||
email.to, ["[email protected]", "[email protected]"] | ||
|
@@ -421,7 +422,7 @@ def test_to_in_headers_only(self): | |
"[email protected]", | ||
headers={"To": "[email protected]"}, | ||
).message() | ||
self.assertEqual(message["To"], "[email protected]") | ||
self.assertEqual(message.get_all("To"), ["[email protected]"]) | ||
|
||
def test_reply_to_header(self): | ||
""" | ||
|
@@ -436,7 +437,7 @@ def test_reply_to_header(self): | |
headers={"Reply-To": "[email protected]"}, | ||
) | ||
message = email.message() | ||
self.assertEqual(message["Reply-To"], "[email protected]") | ||
self.assertEqual(message.get_all("Reply-To"), ["[email protected]"]) | ||
|
||
def test_reply_to_in_headers_only(self): | ||
message = EmailMessage( | ||
|
@@ -446,7 +447,7 @@ def test_reply_to_in_headers_only(self): | |
["[email protected]"], | ||
headers={"Reply-To": "[email protected]"}, | ||
).message() | ||
self.assertEqual(message["Reply-To"], "[email protected]") | ||
self.assertEqual(message.get_all("Reply-To"), ["[email protected]"]) | ||
|
||
def test_multiple_message_call(self): | ||
""" | ||
|
@@ -461,9 +462,9 @@ def test_multiple_message_call(self): | |
headers={"From": "[email protected]"}, | ||
) | ||
message = email.message() | ||
self.assertEqual(message["From"], "[email protected]") | ||
self.assertEqual(message.get_all("From"), ["[email protected]"]) | ||
message = email.message() | ||
self.assertEqual(message["From"], "[email protected]") | ||
self.assertEqual(message.get_all("From"), ["[email protected]"]) | ||
|
||
def test_unicode_address_header(self): | ||
""" | ||
|