From c6e26bcbaa3ca1a70fa26a08d8d933d1a75dc31d Mon Sep 17 00:00:00 2001 From: Ali Asadi Date: Sat, 1 Aug 2026 16:54:04 +0330 Subject: [PATCH] debug avatar retrieve --- apps/chat/tests/test_account_client.py | 6 ++++++ utils/clients/accounts_client.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/chat/tests/test_account_client.py b/apps/chat/tests/test_account_client.py index 2f6bb97..b9f6252 100644 --- a/apps/chat/tests/test_account_client.py +++ b/apps/chat/tests/test_account_client.py @@ -51,6 +51,12 @@ def test_get_users_public_info_bulk_fetches_and_caches(mock_get_client): assert result[str(user_2)]["avatar"] is None mock_httpx.request.assert_called_once() + # The accounts service's actual filter param is `uuid_in` (single + # underscore) — `uuid__in` (Django-ORM style) gets rejected with a 400. + requested_url = mock_httpx.request.call_args.kwargs["url"] + assert "uuid_in=" in requested_url + assert "uuid__in=" not in requested_url + # Second call for the same UUIDs should be served entirely from cache. mock_get_client.reset_mock() result_again = accounts_client.get_users_public_info_bulk([user_1, user_2]) diff --git a/utils/clients/accounts_client.py b/utils/clients/accounts_client.py index 09e3b6d..44a0bca 100644 --- a/utils/clients/accounts_client.py +++ b/utils/clients/accounts_client.py @@ -84,7 +84,7 @@ def get_users_public_info_bulk(uuids: list) -> dict[str, dict]: uuid_in = ",".join(str(u) for u in uncached) response = client.get_httpx_client().request( method="get", - url=f"/users/api/users/?uuid__in={uuid_in}", + url=f"/users/api/users/?uuid_in={uuid_in}", ) if response.status_code == 200: for profile in response.json().get("results", []):