Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
test_subs: Remove test_create_stream_policy_setting.
Ganesh Paware74ad2309126
diff --git a/zerver/tests/test_subs.py b/zerver/tests/test_subs.pyindex 58220a42ecb..50e0f664407 100644--- a/zerver/tests/test_subs.py+++ b/zerver/tests/test_subs.py@@ -1727,88 +1727,6 @@ class StreamAdminTest(ZulipTestCase):self.assert_length(json["removed"], 2)self.assert_length(json["not_removed"], 0)- def test_create_stream_policy_setting(self) -> None:- """- When realm.create_stream_policy setting is Realm.POLICY_MEMBERS_ONLY then- test that any user can create a stream.-- When realm.create_stream_policy setting is Realm.POLICY_ADMINS_ONLY then- test that only admins can create a stream.-- When realm.create_stream_policy setting is Realm.POLICY_FULL_MEMBERS_ONLY then- test that admins and users with accounts older than the waiting period can create a stream.- """- user_profile = self.example_user("hamlet")- user_profile.date_joined = timezone_now()- user_profile.save()- self.login_user(user_profile)- do_change_user_role(user_profile, UserProfile.ROLE_MEMBER, acting_user=None)-- # Allow all members to create streams.- do_set_realm_property(- user_profile.realm,- "create_stream_policy",- Realm.POLICY_MEMBERS_ONLY,- acting_user=None,- )- # Set waiting period to 10 days.- do_set_realm_property(user_profile.realm, "waiting_period_threshold", 10, acting_user=None)-- # Can successfully create stream despite being less than waiting period and not an admin,- # due to create stream policy.- stream_name = ["all_members"]- result = self.common_subscribe_to_streams(user_profile, stream_name)- self.assert_json_success(result)-- # Allow only administrators to create streams.- do_set_realm_property(- user_profile.realm,- "create_stream_policy",- Realm.POLICY_ADMINS_ONLY,- acting_user=None,- )-- # Cannot create stream because not an admin.- stream_name = ["admins_only"]- result = self.common_subscribe_to_streams(user_profile, stream_name, allow_fail=True)- self.assert_json_error(result, "Insufficient permission")-- # Make current user an admin.- do_change_user_role(user_profile, UserProfile.ROLE_REALM_ADMINISTRATOR, acting_user=None)-- # Can successfully create stream as user is now an admin.- stream_name = ["admins_only"]- self.common_subscribe_to_streams(user_profile, stream_name)-- # Allow users older than the waiting period to create streams.- do_set_realm_property(- user_profile.realm,- "create_stream_policy",- Realm.POLICY_FULL_MEMBERS_ONLY,- acting_user=None,- )-- # Can successfully create stream despite being under waiting period because user is admin.- stream_name = ["waiting_period_as_admin"]- self.common_subscribe_to_streams(user_profile, stream_name)-- # Make current user no longer an admin.- do_change_user_role(user_profile, UserProfile.ROLE_MEMBER, acting_user=None)-- # Cannot create stream because user is not an admin and is not older than the waiting- # period.- stream_name = ["waiting_period"]- result = self.common_subscribe_to_streams(user_profile, stream_name, allow_fail=True)- self.assert_json_error(result, "Insufficient permission")-- # Make user account 11 days old..- user_profile.date_joined = timezone_now() - timedelta(days=11)- user_profile.save()-- # Can successfully create stream now that account is old enough.- stream_name = ["waiting_period"]- self.common_subscribe_to_streams(user_profile, stream_name)-def test_remove_already_not_subbed(self) -> None:"""Trying to unsubscribe someone who already isn't subscribed to a stream