diff --git a/zerver/tests/test_messages.py b/zerver/tests/test_messages.py index 047c5a6a95..3596be0040 100644 --- a/zerver/tests/test_messages.py +++ b/zerver/tests/test_messages.py @@ -112,7 +112,7 @@ class TestCrossRealmPMs(ZulipTestCase): user1 = self.create_user(user1_email) user1a = self.create_user(user1a_email) user2 = self.create_user(user2_email) - self.create_user(user3_email) + user3 = self.create_user(user3_email) feedback_bot = self.create_user(feedback_email) support_bot = self.create_user(support_email) @@ -138,6 +138,14 @@ class TestCrossRealmPMs(ZulipTestCase): self.send_message(user1_email, [support_email], Recipient.PERSONAL) assert_message_received(support_bot, user1) + # We have a loophole where I can send PMs to other users as long + # as I copy a cross-realm bot from the same realm. In practice this + # not a bug, since our only cross-realm bots are on the zulip.com + # realm. + self.send_message(user1_email, [user3_email, support_email], Recipient.PERSONAL) + assert_message_received(user3, user1) + assert_message_received(support_bot, user1) + # Users can't email two cross-realm bots at once. (This is just # an anomaly of the current implementation.) with assert_disallowed():