Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
tests: Refactor test_can_create_streams and test_can_subscribe_other_users.
sahil839683b6f7d65fc
diff --git a/zerver/tests/test_subs.py b/zerver/tests/test_subs.pyindex 7d050d7e338..68bdb6e8b93 100644--- a/zerver/tests/test_subs.py+++ b/zerver/tests/test_subs.py@@ -3209,6 +3209,9 @@ class SubscriptionAPITest(ZulipTestCase):othello.role = UserProfile.ROLE_MEMBERothello.realm.create_stream_policy = Realm.POLICY_ADMINS_ONLY+ # Make sure that we are checking the permission with a full member,+ # as full member is the user just below admin in the role hierarchy.+ self.assertFalse(othello.is_provisional_member)self.assertFalse(othello.can_create_streams())othello.realm.create_stream_policy = Realm.POLICY_MEMBERS_ONLY@@ -3216,6 +3219,8 @@ class SubscriptionAPITest(ZulipTestCase):self.assertFalse(othello.can_create_streams())othello.role = UserProfile.ROLE_MEMBER+ self.assertTrue(othello.can_create_streams())+othello.realm.waiting_period_threshold = 1000othello.realm.create_stream_policy = Realm.POLICY_FULL_MEMBERS_ONLYothello.date_joined = timezone_now() - timedelta(@@ -3285,10 +3290,20 @@ class SubscriptionAPITest(ZulipTestCase):do_change_user_role(othello, UserProfile.ROLE_REALM_ADMINISTRATOR)self.assertTrue(othello.can_subscribe_other_users())+ do_set_realm_property(othello.realm, "invite_to_stream_policy", Realm.POLICY_ADMINS_ONLY)+ do_change_user_role(othello, UserProfile.ROLE_MEMBER)+ # Make sure that we are checking the permission with a full member,+ # as full member is the user just below admin in the role hierarchy.+ self.assertFalse(othello.is_provisional_member)+ self.assertFalse(othello.can_subscribe_other_users())++ do_set_realm_property(othello.realm, "invite_to_stream_policy", Realm.POLICY_MEMBERS_ONLY)do_change_user_role(othello, UserProfile.ROLE_GUEST)self.assertFalse(othello.can_subscribe_other_users())do_change_user_role(othello, UserProfile.ROLE_MEMBER)+ self.assertTrue(othello.can_subscribe_other_users())+do_set_realm_property(othello.realm, "waiting_period_threshold", 1000)do_set_realm_property(othello.realm, "invite_to_stream_policy", Realm.POLICY_FULL_MEMBERS_ONLY