tests: Add moderator checks in admins-only stream_post_policy tests.

This commit is contained in:
sahil839 2021-03-29 21:58:27 +05:30 committed by Tim Abbott
parent bc42eab925
commit d4d812bc35
1 changed files with 20 additions and 0 deletions

View File

@ -204,6 +204,26 @@ class MessagePOSTTest(ZulipTestCase):
"Only organization administrators can send to this stream.",
)
moderator_profile = self.example_user("shiva")
self.login_user(moderator_profile)
# Moderators and their owned bots cannot send to STREAM_POST_POLICY_ADMINS streams
self._send_and_verify_message(
moderator_profile,
stream_name,
"Only organization administrators can send to this stream.",
)
moderator_owned_bot = self.create_test_bot(
short_name="whatever3",
full_name="whatever3",
user_profile=moderator_profile,
)
self._send_and_verify_message(
moderator_owned_bot,
stream_name,
"Only organization administrators can send to this stream.",
)
# Bots without owner (except cross realm bot) cannot send to announcement only streams
bot_without_owner = do_create_user(
email="free-bot@zulip.testserver",