Tests: better recipient addresses for live integration tests

Some ESPs have special blacklist handling for mailinator.com;
switch to (deliverable, blackholed) anymail.info test addresses.
This commit is contained in:
medmunds
2018-04-06 15:28:55 -07:00
parent 0ded9f7529
commit d079a506a1
5 changed files with 43 additions and 43 deletions

View File

@@ -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', ['anymail-test-to1@mailinator.com'])
'test@test-mj.anymail.info', ['test+to1@anymail.info'])
self.message.attach_alternative('<p>HTML content</p>', "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['anymail-test-to1@mailinator.com'].status
message_id = anymail_status.recipients['anymail-test-to1@mailinator.com'].message_id
sent_status = anymail_status.recipients['test+to1@anymail.info'].status
message_id = anymail_status.recipients['test+to1@anymail.info'].message_id
self.assertEqual(sent_status, 'sent')
self.assertRegex(message_id, r'.+')
@@ -61,9 +61,9 @@ class MailjetBackendIntegrationTests(SimpleTestCase, AnymailTestMixin):
subject="Anymail Mailjet all-options integration test",
body="This is the text body",
from_email='"Test Sender, Inc." <test@test-mj.anymail.info>',
to=['anymail-test-to1@mailinator.com', '"Recipient, 2nd" <anymail-test-to2@mailinator.com>'],
cc=['anymail-test-cc1@mailinator.com', 'Copy 2 <anymail-test-cc1@mailinator.com>'],
bcc=['anymail-test-bcc1@mailinator.com', 'Blind Copy 2 <anymail-test-bcc2@mailinator.com>'],
to=['test+to1@anymail.info', '"Recipient, 2nd" <test+to2@anymail.info>'],
cc=['test+cc1@anymail.info', 'Copy 2 <test+cc1@anymail.info>'],
bcc=['test+bcc1@anymail.info', 'Blind Copy 2 <test+bcc2@anymail.info>'],
reply_to=['reply1@example.com', '"Reply, 2nd" <reply2@example.com>'],
headers={"X-Anymail-Test": "value"},
@@ -89,10 +89,10 @@ class MailjetBackendIntegrationTests(SimpleTestCase, AnymailTestMixin):
body="This body includes merge data: [[var:value]]\n"
"And global merge data: [[var:global]]",
from_email="Test From <test@test-mj.anymail.info>",
to=["anymail-test-to1@mailinator.com", "Recipient 2 <anymail-test-to2@mailinator.com>"],
to=["test+to1@anymail.info", "Recipient 2 <test+to2@anymail.info>"],
merge_data={
'anymail-test-to1@mailinator.com': {'value': 'one'},
'anymail-test-to2@mailinator.com': {'value': 'two'},
'test+to1@anymail.info': {'value': 'one'},
'test+to2@anymail.info': {'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['anymail-test-to1@mailinator.com'].status, 'sent')
self.assertEqual(recipient_status['anymail-test-to2@mailinator.com'].status, 'sent')
self.assertEqual(recipient_status['test+to1@anymail.info'].status, 'sent')
self.assertEqual(recipient_status['test+to2@anymail.info'].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=["anymail-test-to1@mailinator.com"],
to=["test+to1@anymail.info"],
merge_data={
'anymail-test-to1@mailinator.com': {
'test+to1@anymail.info': {
'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['anymail-test-to1@mailinator.com'].status, 'sent')
self.assertEqual(recipient_status['test+to1@anymail.info'].status, 'sent')
@override_settings(ANYMAIL_MAILJET_API_KEY="Hey, that's not an API key!")
def test_invalid_api_key(self):