SendGrid UUID message_id cleanup

* Update authors
* Update integration tests
* Add webhook message_id = smtp-id fallback test case
* Test webhooks ignore smtp-id in non-fallback cases
* Update docs
This commit is contained in:
medmunds
2018-05-30 13:50:35 -07:00
parent d8d1407c61
commit c0172063a4
8 changed files with 71 additions and 23 deletions

View File

@@ -341,7 +341,7 @@ class SendGridBackendAnymailFeatureTests(SendGridBackendMockAPITestCase):
self.message.metadata = {'user_id': "12345", 'items': 6, 'float': 98.6, 'long': longtype(123)}
self.message.send()
data = self.get_api_call_json()
data['custom_args'].pop('anymail_id', None) # remove Message-ID we added as tracking workaround
data['custom_args'].pop('anymail_id', None) # remove anymail_id we added for tracking
self.assertEqual(data['custom_args'], {'user_id': "12345",
'items': "6", # int converted to a string,
'float': "98.6", # float converted to a string (watch binary rounding!)
@@ -581,6 +581,13 @@ class SendGridBackendAnymailFeatureTests(SendGridBackendMockAPITestCase):
msg.anymail_status.message_id)
self.assertEqual(msg.anymail_status.esp_response.content, self.DEFAULT_RAW_RESPONSE)
@override_settings(ANYMAIL_SENDGRID_GENERATE_MESSAGE_ID=False)
def test_disable_generate_message_id(self):
msg = mail.EmailMessage('Subject', 'Message', 'from@example.com', ['to1@example.com'],)
msg.send()
self.assertIsNone(msg.anymail_status.message_id)
self.assertIsNone(msg.anymail_status.recipients['to1@example.com'].message_id)
# noinspection PyUnresolvedReferences
def test_send_failed_anymail_status(self):
""" If the send fails, anymail_status should contain initial values"""