events: Add option to send partial data.

Server can now send partial data to the client to help in
developement. We don't want this to be widely used right now,
hence no documentation changes have been made.

This will likely be a check on client capability later.
This commit is contained in:
Aman Agrawal
2025-05-19 12:46:38 +05:30
committed by Tim Abbott
parent 01e08f0e32
commit f4e6f2f89b
4 changed files with 47 additions and 0 deletions

View File

@@ -3165,6 +3165,17 @@ class GetProfileTest(ZulipTestCase):
result = self.client_get(f"/json/users/{user.id}")
self.assert_json_error(result, "Insufficient permission")
with self.settings(PARTIAL_USERS=True), self.assert_database_query_count(9):
result = self.client_get("/json/users")
self.assert_json_success(result)
result_dict = orjson.loads(result.content)
all_fetched_users = result_dict["members"]
self.assertEqual(
len(all_fetched_users),
UserProfile.objects.filter(realm=hamlet.realm, is_bot=True).count() + 1,
)
def test_get_inaccessible_user_ids(self) -> None:
polonius = self.example_user("polonius")
bot = self.example_user("default_bot")
@@ -3232,6 +3243,16 @@ class GetProfileTest(ZulipTestCase):
user_ids_to_fetch,
)
with self.settings(PARTIAL_USERS=True), self.assert_database_query_count(4):
result = self.client_get("/json/users")
self.assert_json_success(result)
result_dict = orjson.loads(result.content)
all_fetched_users = result_dict["members"]
self.assertEqual(
len(all_fetched_users),
UserProfile.objects.filter(realm=hamlet.realm, is_bot=True).count(),
)
class DeleteUserTest(ZulipTestCase):
def test_do_delete_user(self) -> None: