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.

tests: Check cases when full members and their bots can send messages.

sahil83915e74a637cd0
diff --git a/zerver/tests/test_message_send.py b/zerver/tests/test_message_send.py
index 40b1ce6a9d8..1daee9f72f1 100644
--- a/zerver/tests/test_message_send.py
+++ b/zerver/tests/test_message_send.py
@@ -279,6 +279,16 @@ class MessagePOSTTest(ZulipTestCase):
non_admin_owned_bot, stream_name, "New members cannot send to this stream."
)
+ non_admin_profile.date_joined = timezone_now() - datetime.timedelta(days=11)
+ non_admin_profile.save()
+ self.assertFalse(non_admin_profile.is_new_member)
+
+ self._send_and_verify_message(non_admin_profile, stream_name)
+ # We again set bot owner here, as date_joined of non_admin_profile is changed.
+ non_admin_owned_bot.bot_owner = non_admin_profile
+ non_admin_owned_bot.save()
+ self._send_and_verify_message(non_admin_owned_bot, stream_name)
+
# Bots without owner (except cross realm bot) cannot send to STREAM_POST_POLICY_ADMINS_ONLY and
# STREAM_POST_POLICY_RESTRICT_NEW_MEMBERS streams
bot_without_owner = do_create_user(