mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 03:41:05 -05:00
Get rid of magic JSON serialization for Mailgun metadata.
Treat Mailgun metadata like all other ESPs: simple key-value dict, where values are strings. If you want to store JSON in metadata, you should serialize and deserialize it yourself.
This commit is contained in:
@@ -111,7 +111,7 @@ class MailgunBackendIntegrationTests(SimpleTestCase, AnymailTestMixin):
|
||||
reply_to=["reply1@example.com", "Reply 2 <reply2@example.com>"],
|
||||
headers={"X-Anymail-Test": "value"},
|
||||
|
||||
metadata={"meta1": "simple string", "meta2": 2, "meta3": {"complex": "value"}},
|
||||
metadata={"meta1": "simple string", "meta2": 2},
|
||||
send_at=send_at,
|
||||
tags=["tag 1", "tag 2"],
|
||||
track_clicks=False,
|
||||
@@ -136,9 +136,7 @@ class MailgunBackendIntegrationTests(SimpleTestCase, AnymailTestMixin):
|
||||
event = events.pop()
|
||||
self.assertCountEqual(event["tags"], ["tag 1", "tag 2"]) # don't care about order
|
||||
self.assertEqual(event["user-variables"],
|
||||
{"meta1": "simple string",
|
||||
"meta2": "2", # numbers become strings
|
||||
"meta3": '{"complex": "value"}'}) # complex values become json
|
||||
{"meta1": "simple string", "meta2": "2"}) # all metadata values become strings
|
||||
|
||||
self.assertEqual(event["message"]["scheduled-for"], send_at_timestamp)
|
||||
self.assertCountEqual(event["message"]["recipients"],
|
||||
|
||||
Reference in New Issue
Block a user