1
- import json
2
1
from datetime import datetime , timezone
3
2
from unittest .mock import ANY
4
3
@@ -16,7 +15,7 @@ def call_webhook(self):
16
15
return self .client .post (
17
16
"/anymail/mailtrap/tracking/" ,
18
17
content_type = "application/json" ,
19
- data = json . dumps ({}) ,
18
+ data = {} ,
20
19
)
21
20
22
21
# Actual tests are in WebhookBasicAuthTestCase
@@ -42,7 +41,7 @@ def test_sent_event(self):
42
41
response = self .client .post (
43
42
"/anymail/mailtrap/tracking/" ,
44
43
content_type = "application/json" ,
45
- data = json . dumps ( payload ) ,
44
+ data = payload ,
46
45
)
47
46
self .assertEqual (response .status_code , 200 )
48
47
kwargs = self .assert_handler_called_once_with (
@@ -87,7 +86,7 @@ def test_open_event(self):
87
86
response = self .client .post (
88
87
"/anymail/mailtrap/tracking/" ,
89
88
content_type = "application/json" ,
90
- data = json . dumps ( payload ) ,
89
+ data = payload ,
91
90
)
92
91
self .assertEqual (response .status_code , 200 )
93
92
kwargs = self .assert_handler_called_once_with (
@@ -129,7 +128,7 @@ def test_click_event(self):
129
128
response = self .client .post (
130
129
"/anymail/mailtrap/tracking/" ,
131
130
content_type = "application/json" ,
132
- data = json . dumps ( payload ) ,
131
+ data = payload ,
133
132
)
134
133
self .assertEqual (response .status_code , 200 )
135
134
kwargs = self .assert_handler_called_once_with (
@@ -174,7 +173,7 @@ def test_bounce_event(self):
174
173
response = self .client .post (
175
174
"/anymail/mailtrap/tracking/" ,
176
175
content_type = "application/json" ,
177
- data = json . dumps ( payload ) ,
176
+ data = payload ,
178
177
)
179
178
self .assertEqual (response .status_code , 200 )
180
179
kwargs = self .assert_handler_called_once_with (
@@ -218,7 +217,7 @@ def test_soft_bounce_event(self):
218
217
response = self .client .post (
219
218
"/anymail/mailtrap/tracking/" ,
220
219
content_type = "application/json" ,
221
- data = json . dumps ( payload ) ,
220
+ data = payload ,
222
221
)
223
222
self .assertEqual (response .status_code , 200 )
224
223
kwargs = self .assert_handler_called_once_with (
@@ -256,7 +255,7 @@ def test_spam_event(self):
256
255
response = self .client .post (
257
256
"/anymail/mailtrap/tracking/" ,
258
257
content_type = "application/json" ,
259
- data = json . dumps ( payload ) ,
258
+ data = payload ,
260
259
)
261
260
self .assertEqual (response .status_code , 200 )
262
261
kwargs = self .assert_handler_called_once_with (
@@ -291,7 +290,7 @@ def test_unsubscribe_event(self):
291
290
response = self .client .post (
292
291
"/anymail/mailtrap/tracking/" ,
293
292
content_type = "application/json" ,
294
- data = json . dumps ( payload ) ,
293
+ data = payload ,
295
294
)
296
295
self .assertEqual (response .status_code , 200 )
297
296
kwargs = self .assert_handler_called_once_with (
@@ -327,7 +326,7 @@ def test_suspension_event(self):
327
326
response = self .client .post (
328
327
"/anymail/mailtrap/tracking/" ,
329
328
content_type = "application/json" ,
330
- data = json . dumps ( payload ) ,
329
+ data = payload ,
331
330
)
332
331
self .assertEqual (response .status_code , 200 )
333
332
kwargs = self .assert_handler_called_once_with (
@@ -359,7 +358,7 @@ def test_reject_event(self):
359
358
response = self .client .post (
360
359
"/anymail/mailtrap/tracking/" ,
361
360
content_type = "application/json" ,
362
- data = json . dumps ( payload ) ,
361
+ data = payload ,
363
362
)
364
363
self .assertEqual (response .status_code , 200 )
365
364
kwargs = self .assert_handler_called_once_with (
0 commit comments