Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
tests: Move test to check permission to update message retention setting.
Sahil Batra79c2972232f8
diff --git a/zerver/tests/test_channel_permissions.py b/zerver/tests/test_channel_permissions.pyindex f0ff3a2d96d..fd2e963c658 100644--- a/zerver/tests/test_channel_permissions.py+++ b/zerver/tests/test_channel_permissions.py@@ -727,3 +727,22 @@ class ChannelSubscriptionPermissionTest(ZulipTestCase):stream_list=[private_stream, private_stream_2],skip_changing_group_setting=True,)++ def test_change_stream_message_retention_days_requires_realm_owner(self) -> None:+ user_profile = self.example_user("iago")+ self.login_user(user_profile)+ realm = user_profile.realm+ stream = self.subscribe(user_profile, "stream_name1")++ result = self.client_patch(+ f"/json/streams/{stream.id}", {"message_retention_days": orjson.dumps(2).decode()}+ )+ self.assert_json_error(result, "Must be an organization owner")++ do_change_user_role(user_profile, UserProfile.ROLE_REALM_OWNER, acting_user=None)+ result = self.client_patch(+ f"/json/streams/{stream.id}", {"message_retention_days": orjson.dumps(2).decode()}+ )+ self.assert_json_success(result)+ stream = get_stream("stream_name1", realm)+ self.assertEqual(stream.message_retention_days, 2)diff --git a/zerver/tests/test_subs.py b/zerver/tests/test_subs.pyindex 927d4898db0..b3e6572d39a 100644--- a/zerver/tests/test_subs.py+++ b/zerver/tests/test_subs.py@@ -2207,25 +2207,6 @@ class StreamAdminTest(ZulipTestCase):)self.assert_json_error(result, "Bad value for 'message_retention_days': 0")- def test_change_stream_message_retention_days_requires_realm_owner(self) -> None:- user_profile = self.example_user("iago")- self.login_user(user_profile)- realm = user_profile.realm- stream = self.subscribe(user_profile, "stream_name1")-- result = self.client_patch(- f"/json/streams/{stream.id}", {"message_retention_days": orjson.dumps(2).decode()}- )- self.assert_json_error(result, "Must be an organization owner")-- do_change_user_role(user_profile, UserProfile.ROLE_REALM_OWNER, acting_user=None)- result = self.client_patch(- f"/json/streams/{stream.id}", {"message_retention_days": orjson.dumps(2).decode()}- )- self.assert_json_success(result)- stream = get_stream("stream_name1", realm)- self.assertEqual(stream.message_retention_days, 2)-def do_test_change_stream_permission_setting(self, setting_name: str) -> None:user_profile = self.example_user("iago")realm = user_profile.realm