diff options
| author | sindre <sindre.hestad.moe@aplia.no> | 2023-10-18 16:03:39 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-10-25 08:52:31 +0200 |
| commit | 64060d1c17e9d582b2b07cf866b1792267f07a79 (patch) | |
| tree | fe0815cae41c3713ad4f7f0d2966cde477853e90 /tests/mail | |
| parent | fdd1323b9c83e56184e0c992af8faf8d54327775 (diff) | |
Fixed #34904 -- Prevented mutating sent emails from outbox in locmem email backend.
Diffstat (limited to 'tests/mail')
| -rw-r--r-- | tests/mail/tests.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/mail/tests.py b/tests/mail/tests.py index 848ee32e9f..6f92194d1b 100644 --- a/tests/mail/tests.py +++ b/tests/mail/tests.py @@ -1554,6 +1554,19 @@ class LocmemBackendTests(BaseEmailBackendTests, SimpleTestCase): "Subject\nMultiline", "Content", "from@example.com", ["to@example.com"] ) + def test_outbox_not_mutated_after_send(self): + email = EmailMessage( + subject="correct subject", + body="test body", + from_email="from@example.com", + to=["to@example.com"], + ) + email.send() + email.subject = "other subject" + email.to.append("other@example.com") + self.assertEqual(mail.outbox[0].subject, "correct subject") + self.assertEqual(mail.outbox[0].to, ["to@example.com"]) + class FileBackendTests(BaseEmailBackendTests, SimpleTestCase): email_backend = "django.core.mail.backends.filebased.EmailBackend" |
