Skip to content

Commit

Permalink
Mailtrap webhook tests: remove unnecessary json.dumps
Browse files Browse the repository at this point in the history
  • Loading branch information
cahna committed Nov 24, 2024
1 parent 1da6971 commit 7597448
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions tests/test_mailtrap_webhooks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import json
from datetime import datetime, timezone
from unittest.mock import ANY

Expand All @@ -16,7 +15,7 @@ def call_webhook(self):
return self.client.post(
"/anymail/mailtrap/tracking/",
content_type="application/json",
data=json.dumps({}),
data={},
)

# Actual tests are in WebhookBasicAuthTestCase
Expand All @@ -42,7 +41,7 @@ def test_sent_event(self):
response = self.client.post(
"/anymail/mailtrap/tracking/",
content_type="application/json",
data=json.dumps(payload),
data=payload,
)
self.assertEqual(response.status_code, 200)
kwargs = self.assert_handler_called_once_with(
Expand Down Expand Up @@ -87,7 +86,7 @@ def test_open_event(self):
response = self.client.post(
"/anymail/mailtrap/tracking/",
content_type="application/json",
data=json.dumps(payload),
data=payload,
)
self.assertEqual(response.status_code, 200)
kwargs = self.assert_handler_called_once_with(
Expand Down Expand Up @@ -129,7 +128,7 @@ def test_click_event(self):
response = self.client.post(
"/anymail/mailtrap/tracking/",
content_type="application/json",
data=json.dumps(payload),
data=payload,
)
self.assertEqual(response.status_code, 200)
kwargs = self.assert_handler_called_once_with(
Expand Down Expand Up @@ -174,7 +173,7 @@ def test_bounce_event(self):
response = self.client.post(
"/anymail/mailtrap/tracking/",
content_type="application/json",
data=json.dumps(payload),
data=payload,
)
self.assertEqual(response.status_code, 200)
kwargs = self.assert_handler_called_once_with(
Expand Down Expand Up @@ -218,7 +217,7 @@ def test_soft_bounce_event(self):
response = self.client.post(
"/anymail/mailtrap/tracking/",
content_type="application/json",
data=json.dumps(payload),
data=payload,
)
self.assertEqual(response.status_code, 200)
kwargs = self.assert_handler_called_once_with(
Expand Down Expand Up @@ -256,7 +255,7 @@ def test_spam_event(self):
response = self.client.post(
"/anymail/mailtrap/tracking/",
content_type="application/json",
data=json.dumps(payload),
data=payload,
)
self.assertEqual(response.status_code, 200)
kwargs = self.assert_handler_called_once_with(
Expand Down Expand Up @@ -291,7 +290,7 @@ def test_unsubscribe_event(self):
response = self.client.post(
"/anymail/mailtrap/tracking/",
content_type="application/json",
data=json.dumps(payload),
data=payload,
)
self.assertEqual(response.status_code, 200)
kwargs = self.assert_handler_called_once_with(
Expand Down Expand Up @@ -327,7 +326,7 @@ def test_suspension_event(self):
response = self.client.post(
"/anymail/mailtrap/tracking/",
content_type="application/json",
data=json.dumps(payload),
data=payload,
)
self.assertEqual(response.status_code, 200)
kwargs = self.assert_handler_called_once_with(
Expand Down Expand Up @@ -359,7 +358,7 @@ def test_reject_event(self):
response = self.client.post(
"/anymail/mailtrap/tracking/",
content_type="application/json",
data=json.dumps(payload),
data=payload,
)
self.assertEqual(response.status_code, 200)
kwargs = self.assert_handler_called_once_with(
Expand Down

0 comments on commit 7597448

Please sign in to comment.