send_email: Enforce in tests that all send_email calls JSON-roundtrip.

This commit is contained in:
Alex Vandiver
2025-05-05 19:30:30 +00:00
committed by Tim Abbott
parent 33f7da23a0
commit aa63b40f27

View File

@@ -358,6 +358,11 @@ def send_email(
),
)
else:
if settings.TEST_SUITE:
# In tests, verify that the context object is
# JSON-serializable, as may happen in production using
# EMAIL_ALWAYS_ENQUEUED, above.
context = orjson.loads(orjson.dumps(context))
send_immediate_email(
template_prefix,
to_user_ids,