mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 03:41:05 -05:00
Mailgun: fix webhook error with null delivery-status
Mailgun now sometimes posts `"delivery-status": null` in the tracking event payload. Avoid raising an AttributeError when that occurs. Fixes #361
This commit is contained in:
@@ -630,6 +630,22 @@ class MailgunTestCase(WebhookTestCase):
|
||||
self.assertEqual(event.event_type, "clicked")
|
||||
self.assertEqual(event.click_url, "https://example.com/test")
|
||||
|
||||
def test_delivery_status_is_none_event(self):
|
||||
raw_event = mailgun_sign_payload(
|
||||
{
|
||||
"event-data": {
|
||||
"event": "accepted",
|
||||
"delivery-status": None,
|
||||
}
|
||||
}
|
||||
)
|
||||
response = self.client.post(
|
||||
"/anymail/mailgun/tracking/",
|
||||
data=json.dumps(raw_event),
|
||||
content_type="application/json",
|
||||
)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
|
||||
@tag("mailgun")
|
||||
@override_settings(ANYMAIL_MAILGUN_WEBHOOK_SIGNING_KEY=TEST_WEBHOOK_SIGNING_KEY)
|
||||
|
||||
Reference in New Issue
Block a user