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.

test_invite: Explicitly test that no emails are actually sent.

Alex Vandiver695730b60943
diff --git a/zerver/tests/test_invite.py b/zerver/tests/test_invite.py
index b6b10a0d966..901a43337c0 100644
--- a/zerver/tests/test_invite.py
+++ b/zerver/tests/test_invite.py
@@ -722,11 +722,18 @@ [email protected]""",
self.login("iago")
self.invite(invitee_emails, ["Denmark"])
- invitee_emails = ", ".join(str(i) for i in range(get_realm("zulip").max_invites - 1))
+ self.check_sent_emails(["[email protected]", "[email protected]"])
+ from django.core import mail
+
+ mail.outbox = []
+ invitee_emails = ", ".join(
+ f"more-{i}@zulip.com" for i in range(get_realm("zulip").max_invites - 1)
+ )
self.assert_json_error(
self.invite(invitee_emails, ["Denmark"]),
"To protect users, Zulip limits the number of invitations you can send in one day. Because you have reached the limit, no invitations were sent.",
)
+ self.check_sent_emails([])
def test_missing_or_invalid_params(self) -> None:
"""