mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-11 03:38:38 +00:00
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.
This commit is contained in:
parent
98fab801b4
commit
8206feb2c2
1 changed files with 11 additions and 0 deletions
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue