test: Check json_fetch_raw_message raises error.

This commit adds a check to verify that json_fetch_raw_message
raises error when enable_spectator_access is False.
This commit is contained in:
Sahil Batra 2021-11-24 12:53:38 +05:30 committed by Tim Abbott
parent 733cad1f5c
commit 30c190a120
1 changed files with 9 additions and 0 deletions

View File

@ -351,6 +351,15 @@ class EditMessageTest(EditMessageTestCase):
result, "Not logged in: API authentication or user session required", 401 result, "Not logged in: API authentication or user session required", 401
) )
do_set_realm_property(
user_profile.realm, "enable_spectator_access", False, acting_user=None
)
result = self.client_get("/json/messages/" + str(web_public_stream_msg_id))
self.assert_json_error(
result, "Not logged in: API authentication or user session required", 401
)
do_set_realm_property(user_profile.realm, "enable_spectator_access", True, acting_user=None)
# Verify success with web-public stream and default SELF_HOSTED plan type. # Verify success with web-public stream and default SELF_HOSTED plan type.
result = self.client_get("/json/messages/" + str(web_public_stream_msg_id)) result = self.client_get("/json/messages/" + str(web_public_stream_msg_id))
self.assert_json_success(result) self.assert_json_success(result)