diff --git a/tests/test_mailgun_integration.py b/tests/test_mailgun_integration.py index 3d0b982..0017ef3 100644 --- a/tests/test_mailgun_integration.py +++ b/tests/test_mailgun_integration.py @@ -37,8 +37,8 @@ class MailgunBackendIntegrationTests(SimpleTestCase, AnymailTestMixin): def setUp(self): super(MailgunBackendIntegrationTests, self).setUp() - self.message = AnymailMessage('Anymail integration test', 'Text content', - 'from@example.com', ['to@example.com']) + self.message = AnymailMessage('Anymail Mailgun integration test', 'Text content', + 'from@example.com', ['anymail-test-to1@mailinator.com']) self.message.attach_alternative('

HTML content

', "text/html") def fetch_mailgun_events(self, message_id, event=None, @@ -87,8 +87,8 @@ class MailgunBackendIntegrationTests(SimpleTestCase, AnymailTestMixin): self.assertEqual(sent_count, 1) anymail_status = self.message.anymail_status - sent_status = anymail_status.recipients['to@example.com'].status - message_id = anymail_status.recipients['to@example.com'].message_id + sent_status = anymail_status.recipients['anymail-test-to1@mailinator.com'].status + message_id = anymail_status.recipients['anymail-test-to1@mailinator.com'].message_id self.assertEqual(sent_status, 'queued') # Mailgun always queues self.assertGreater(len(message_id), 0) # don't know what it'll be, but it should exist @@ -100,12 +100,12 @@ class MailgunBackendIntegrationTests(SimpleTestCase, AnymailTestMixin): send_at = datetime.now().replace(microsecond=0) + timedelta(minutes=2) send_at_timestamp = mktime(send_at.timetuple()) # python3: send_at.timestamp() message = AnymailMessage( - subject="Anymail all-options integration test", + subject="Anymail Mailgun all-options integration test", body="This is the text body", from_email="Test From , also-from@example.com", - to=["to1@example.com", "Recipient 2 "], - cc=["cc1@example.com", "Copy 2 "], - bcc=["bcc1@example.com", "Blind Copy 2 "], + to=["anymail-test-to1@mailinator.com", "Recipient 2 "], + cc=["anymail-test-cc1@mailinator.com", "Copy 2 "], + bcc=["anymail-test-bcc1@mailinator.com", "Blind Copy 2 "], reply_to=["reply1@example.com", "Reply 2 "], headers={"X-Anymail-Test": "value"}, @@ -137,13 +137,15 @@ class MailgunBackendIntegrationTests(SimpleTestCase, AnymailTestMixin): {"meta1": "simple string", "meta2": "2"}) # all metadata values become strings self.assertEqual(event["message"]["scheduled-for"], send_at_timestamp) - self.assertIn(event["recipient"], ['to1@example.com', 'to2@example.com', 'cc1@example.com', - 'cc2@example.com', 'bcc1@example.com', 'bcc2@example.com']) + self.assertIn(event["recipient"], ['anymail-test-to1@mailinator.com', 'anymail-test-to2@mailinator.com', + 'anymail-test-cc1@mailinator.com', 'anymail-test-cc1@mailinator.com', + 'anymail-test-bcc1@mailinator.com', 'anymail-test-bcc2@mailinator.com']) headers = event["message"]["headers"] self.assertEqual(headers["from"], "Test From , also-from@example.com") - self.assertEqual(headers["to"], "to1@example.com, Recipient 2 ") - self.assertEqual(headers["subject"], "Anymail all-options integration test") + self.assertEqual(headers["to"], + "anymail-test-to1@mailinator.com, Recipient 2 ") + self.assertEqual(headers["subject"], "Anymail Mailgun all-options integration test") attachments = event["message"]["attachments"] self.assertEqual(len(attachments), 2) # because inline image shouldn't be an attachment diff --git a/tests/test_mailjet_integration.py b/tests/test_mailjet_integration.py index 271e9da..e82d79c 100644 --- a/tests/test_mailjet_integration.py +++ b/tests/test_mailjet_integration.py @@ -39,7 +39,7 @@ class MailjetBackendIntegrationTests(SimpleTestCase, AnymailTestMixin): def setUp(self): super(MailjetBackendIntegrationTests, self).setUp() self.message = AnymailMessage('Anymail Mailjet integration test', 'Text content', - 'test@test-mj.anymail.info', ['to@example.com']) + 'test@test-mj.anymail.info', ['anymail-test-to1@mailinator.com']) self.message.attach_alternative('

HTML content

', "text/html") def test_simple_send(self): @@ -48,8 +48,8 @@ class MailjetBackendIntegrationTests(SimpleTestCase, AnymailTestMixin): self.assertEqual(sent_count, 1) anymail_status = self.message.anymail_status - sent_status = anymail_status.recipients['to@example.com'].status - message_id = anymail_status.recipients['to@example.com'].message_id + sent_status = anymail_status.recipients['anymail-test-to1@mailinator.com'].status + message_id = anymail_status.recipients['anymail-test-to1@mailinator.com'].message_id self.assertEqual(sent_status, 'sent') self.assertRegex(message_id, r'.+') @@ -58,12 +58,12 @@ class MailjetBackendIntegrationTests(SimpleTestCase, AnymailTestMixin): def test_all_options(self): message = AnymailMessage( - subject="Anymail all-options integration test", + subject="Anymail Mailjet all-options integration test", body="This is the text body", from_email='"Test Sender, Inc." ', - to=['to1@example.com', '"Recipient, 2nd" '], - cc=['cc1@example.com', 'Copy 2 '], - bcc=['bcc1@example.com', 'Blind Copy 2 '], + to=['anymail-test-to1@mailinator.com', '"Recipient, 2nd" '], + cc=['anymail-test-cc1@mailinator.com', 'Copy 2 '], + bcc=['anymail-test-bcc1@mailinator.com', 'Blind Copy 2 '], reply_to=['reply1@example.com', '"Reply, 2nd" '], headers={"X-Anymail-Test": "value"}, @@ -85,14 +85,14 @@ class MailjetBackendIntegrationTests(SimpleTestCase, AnymailTestMixin): def test_merge_data(self): message = AnymailMessage( - subject="Anymail merge_data test", # Mailjet doesn't support merge fields in the subject + subject="Anymail Mailjet merge_data test", # Mailjet doesn't support merge fields in the subject body="This body includes merge data: [[var:value]]\n" "And global merge data: [[var:global]]", from_email="Test From ", - to=["to1@example.com", "Recipient 2 "], + to=["anymail-test-to1@mailinator.com", "Recipient 2 "], merge_data={ - 'to1@example.com': {'value': 'one'}, - 'to2@example.com': {'value': 'two'}, + 'anymail-test-to1@mailinator.com': {'value': 'one'}, + 'anymail-test-to2@mailinator.com': {'value': 'two'}, }, merge_global_data={ 'global': 'global_value' @@ -100,15 +100,15 @@ class MailjetBackendIntegrationTests(SimpleTestCase, AnymailTestMixin): ) message.send() recipient_status = message.anymail_status.recipients - self.assertEqual(recipient_status['to1@example.com'].status, 'sent') - self.assertEqual(recipient_status['to2@example.com'].status, 'sent') + self.assertEqual(recipient_status['anymail-test-to1@mailinator.com'].status, 'sent') + self.assertEqual(recipient_status['anymail-test-to2@mailinator.com'].status, 'sent') def test_stored_template(self): message = AnymailMessage( template_id='176375', # ID of the real template named 'test-template' in our Mailjet test account - to=["to1@example.com"], + to=["anymail-test-to1@mailinator.com"], merge_data={ - 'to1@example.com': { + 'anymail-test-to1@mailinator.com': { 'name': "Test Recipient", } }, @@ -119,7 +119,7 @@ class MailjetBackendIntegrationTests(SimpleTestCase, AnymailTestMixin): message.from_email = None # use the template's sender email/name message.send() recipient_status = message.anymail_status.recipients - self.assertEqual(recipient_status['to1@example.com'].status, 'sent') + self.assertEqual(recipient_status['anymail-test-to1@mailinator.com'].status, 'sent') @override_settings(ANYMAIL_MAILJET_API_KEY="Hey, that's not an API key!") def test_invalid_api_key(self): diff --git a/tests/test_mandrill_integration.py b/tests/test_mandrill_integration.py index 901fc78..2b09d9a 100644 --- a/tests/test_mandrill_integration.py +++ b/tests/test_mandrill_integration.py @@ -33,7 +33,7 @@ class MandrillBackendIntegrationTests(SimpleTestCase, AnymailTestMixin): def setUp(self): super(MandrillBackendIntegrationTests, self).setUp() self.message = mail.EmailMultiAlternatives('Anymail Mandrill integration test', 'Text content', - 'from@example.com', ['to@example.com']) + 'from@example.com', ['anymail-test-to1@mailinator.com']) self.message.attach_alternative('

HTML content

', "text/html") def test_simple_send(self): @@ -43,8 +43,8 @@ class MandrillBackendIntegrationTests(SimpleTestCase, AnymailTestMixin): # noinspection PyUnresolvedReferences anymail_status = self.message.anymail_status - sent_status = anymail_status.recipients['to@example.com'].status - message_id = anymail_status.recipients['to@example.com'].message_id + sent_status = anymail_status.recipients['anymail-test-to1@mailinator.com'].status + message_id = anymail_status.recipients['anymail-test-to1@mailinator.com'].message_id self.assertIn(sent_status, ['sent', 'queued']) # successful send (could still bounce later) self.assertGreater(len(message_id), 0) # don't know what it'll be, but it should exist @@ -54,12 +54,12 @@ class MandrillBackendIntegrationTests(SimpleTestCase, AnymailTestMixin): def test_all_options(self): message = AnymailMessage( - subject="Anymail all-options integration test", + subject="Anymail Mandrill all-options integration test", body="This is the text body", from_email="Test From ", - to=["to1@example.com", "Recipient 2 "], - cc=["cc1@example.com", "Copy 2 "], - bcc=["bcc1@example.com", "Blind Copy 2 "], + to=["anymail-test-to1@mailinator.com", "Recipient 2 "], + cc=["anymail-test-cc1@mailinator.com", "Copy 2 "], + bcc=["anymail-test-bcc1@mailinator.com", "Blind Copy 2 "], reply_to=["reply1@example.com", "Reply 2 "], headers={"X-Anymail-Test": "value"}, diff --git a/tests/test_postmark_integration.py b/tests/test_postmark_integration.py index 433976b..2f652d4 100644 --- a/tests/test_postmark_integration.py +++ b/tests/test_postmark_integration.py @@ -22,17 +22,17 @@ class PostmarkBackendIntegrationTests(SimpleTestCase, AnymailTestMixin): def setUp(self): super(PostmarkBackendIntegrationTests, self).setUp() self.message = AnymailMessage('Anymail Postmark integration test', 'Text content', - 'from@example.com', ['to@example.com']) + 'from@example.com', ['anymail-test-to1@mailinator.com']) self.message.attach_alternative('

HTML content

', "text/html") def test_simple_send(self): - # Example of getting the SendGrid send status and message id from the message + # Example of getting the Postmark send status and message id from the message sent_count = self.message.send() self.assertEqual(sent_count, 1) anymail_status = self.message.anymail_status - sent_status = anymail_status.recipients['to@example.com'].status - message_id = anymail_status.recipients['to@example.com'].message_id + sent_status = anymail_status.recipients['anymail-test-to1@mailinator.com'].status + message_id = anymail_status.recipients['anymail-test-to1@mailinator.com'].message_id self.assertEqual(sent_status, 'sent') self.assertGreater(len(message_id), 0) # non-empty string @@ -41,13 +41,13 @@ class PostmarkBackendIntegrationTests(SimpleTestCase, AnymailTestMixin): def test_all_options(self): message = AnymailMessage( - subject="Anymail all-options integration test", + subject="Anymail Postmark all-options integration test", body="This is the text body", # Postmark accepts multiple from_email addresses, but truncates to the first on their end from_email="Test From , also-from@example.com", - to=["to1@example.com", "Recipient 2 "], - cc=["cc1@example.com", "Copy 2 "], - bcc=["bcc1@example.com", "Blind Copy 2 "], + to=["anymail-test-to1@mailinator.com", "Recipient 2 "], + cc=["anymail-test-cc1@mailinator.com", "Copy 2 "], + bcc=["anymail-test-bcc1@mailinator.com", "Blind Copy 2 "], reply_to=["reply1@example.com", "Reply 2 "], headers={"X-Anymail-Test": "value"}, diff --git a/tests/test_sendinblue_integration.py b/tests/test_sendinblue_integration.py index 18bcd9b..fc31639 100644 --- a/tests/test_sendinblue_integration.py +++ b/tests/test_sendinblue_integration.py @@ -35,7 +35,7 @@ class SendinBlueBackendIntegrationTests(SimpleTestCase, AnymailTestMixin): super(SendinBlueBackendIntegrationTests, self).setUp() self.message = AnymailMessage('Anymail SendinBlue integration test', 'Text content', - 'from@example.com', ['to@example.com']) + 'from@test-sb.anymail.info', ['anymail-test-to1@mailinator.com']) self.message.attach_alternative('

HTML content

', "text/html") def test_simple_send(self): @@ -44,8 +44,8 @@ class SendinBlueBackendIntegrationTests(SimpleTestCase, AnymailTestMixin): self.assertEqual(sent_count, 1) anymail_status = self.message.anymail_status - sent_status = anymail_status.recipients['to@example.com'].status - message_id = anymail_status.recipients['to@example.com'].message_id + sent_status = anymail_status.recipients['anymail-test-to1@mailinator.com'].status + message_id = anymail_status.recipients['anymail-test-to1@mailinator.com'].message_id self.assertEqual(sent_status, 'queued') # SendinBlue always queues self.assertRegex(message_id, r'\<.+@.+\>') # Message-ID can be ...@smtp-relay.mail.fr or .sendinblue.com @@ -54,12 +54,12 @@ class SendinBlueBackendIntegrationTests(SimpleTestCase, AnymailTestMixin): def test_all_options(self): message = AnymailMessage( - subject="Anymail all-options integration test", + subject="Anymail SendinBlue all-options integration test", body="This is the text body", - from_email='"Test From, with comma" ', - to=["to1@example.com", '"Recipient 2, OK?" '], - cc=["cc1@example.com", "Copy 2 "], - bcc=["bcc1@example.com", "Blind Copy 2 "], + from_email='"Test From, with comma" ', + to=["anymail-test-to1@mailinator.com", '"Recipient 2, OK?" '], + cc=["anymail-test-cc1@mailinator.com", "Copy 2 "], + bcc=["anymail-test-bcc1@mailinator.com", "Blind Copy 2 "], reply_to=['"Reply, with comma" '], # SendinBlue API v3 only supports single reply-to headers={"X-Anymail-Test": "value", "X-Anymail-Count": 3}, @@ -78,7 +78,7 @@ class SendinBlueBackendIntegrationTests(SimpleTestCase, AnymailTestMixin): def test_template(self): message = AnymailMessage( template_id=1, # There is a template with this id in the Anymail test account - to=["to1@example.com"], # SendinBlue doesn't allow recipient display names with templates + to=["anymail-test-to1@mailinator.com"], # SendinBlue doesn't allow recipient display names with templates reply_to=["reply@example.com"], tags=["using-template"], headers={"X-Anymail-Test": "group: A, variation: C"},