From 8206feb2c265f541dc7a2b9154624849b183c5e0 Mon Sep 17 00:00:00 2001 From: songkuan-zheng <252822057+songkuan-zheng@users.noreply.github.com> Date: Tue, 16 Jun 2026 11:43:34 +0000 Subject: [PATCH] test(proxy): stub _populate_team_access_on_models in v1 model_info fixture Upstream's model_info_v1 refactor introduced _populate_team_access_on_models, which calls UserRepository(prisma_client).table.find_unique. The fixture's MagicMock prisma_client can't be awaited there, so the v1 route tests failed after rebasing onto litellm_internal_staging. Stub the helper to a pass-through so the tests still exercise the user.models filter (the behavior under test) without dragging in real DB mocks. --- .../test_v1_model_info_user_filter.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_litellm/proxy/discovery_endpoints/test_v1_model_info_user_filter.py b/tests/test_litellm/proxy/discovery_endpoints/test_v1_model_info_user_filter.py index b4648251be6..47ff8231362 100644 --- a/tests/test_litellm/proxy/discovery_endpoints/test_v1_model_info_user_filter.py +++ b/tests/test_litellm/proxy/discovery_endpoints/test_v1_model_info_user_filter.py @@ -70,6 +70,17 @@ def configure_router(monkeypatch): monkeypatch.setattr(ps, "general_settings", {}) monkeypatch.setattr(ps, "prisma_client", MagicMock()) monkeypatch.setattr(ps, "user_api_key_cache", DualCache()) + + # Upstream's model_info_v1 invokes _populate_team_access_on_models, + # which hits UserRepository(prisma_client).table.find_unique. The + # MagicMock prisma_client above can't be awaited there; stub the + # helper to a pass-through so the route exercises the user.models + # filter (the thing these tests cover) without dragging in real DB + # mocks. + async def _passthrough(*, user_api_key_dict, prisma_client, llm_router, all_models): + return all_models + + monkeypatch.setattr(ps, "_populate_team_access_on_models", _passthrough) return router