Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

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

Alex Vandiveraa63b40f278c
diff --git a/zerver/lib/send_email.py b/zerver/lib/send_email.py
index 8a694a3cef4..d7ccc514659 100644
--- a/zerver/lib/send_email.py
+++ b/zerver/lib/send_email.py
@@ -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,