diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2011-12-30 12:44:35 +0000 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2011-12-30 12:44:35 +0000 |
| commit | 5e75678c8b7d3cc54aa27b7b682561c5fee64c6c (patch) | |
| tree | 59a715d1fa5742387026a882c8adec6fdb218497 /tests | |
| parent | e5999ce234c2e2af05ba5ca5f7e44f35c864603e (diff) | |
Fixed #17444 -- Made it possible to customize the 'To' header in emails.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17293 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/mail/tests.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/regressiontests/mail/tests.py b/tests/regressiontests/mail/tests.py index ac97f1573a..52e251f3ee 100644 --- a/tests/regressiontests/mail/tests.py +++ b/tests/regressiontests/mail/tests.py @@ -96,6 +96,24 @@ class MailTests(TestCase): message = email.message() self.assertEqual(message['From'], 'from@example.com') + def test_to_header(self): + """ + Make sure we can manually set the To header (#17444) + """ + email = EmailMessage('Subject', 'Content', 'bounce@example.com', + ['list-subscriber@example.com', 'list-subscriber2@example.com'], + headers={'To': 'mailing-list@example.com'}) + message = email.message() + self.assertEqual(message['To'], 'mailing-list@example.com') + self.assertEqual(email.to, ['list-subscriber@example.com', 'list-subscriber2@example.com']) + + # If we don't set the To header manually, it should default to the `to` argument to the constructor + email = EmailMessage('Subject', 'Content', 'bounce@example.com', + ['list-subscriber@example.com', 'list-subscriber2@example.com']) + message = email.message() + self.assertEqual(message['To'], 'list-subscriber@example.com, list-subscriber2@example.com') + self.assertEqual(email.to, ['list-subscriber@example.com', 'list-subscriber2@example.com']) + def test_multiple_message_call(self): """ Regression for #13259 - Make sure that headers are not changed when |
