fix: mock prisma find_unique as AsyncMock in get_agent_by_id test

The endpoint now refreshes agent spend from DB when found in registry,
so the test must provide an AsyncMock for the awaited find_unique call.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Krrish Dholakia 2026-03-04 19:35:18 -08:00
parent 9aa3afc8d7
commit 0b4cb09d6b

View file

@ -295,6 +295,9 @@ class TestAgentRBACInternalUser:
return_value=_sample_agent_response()
)
with patch("litellm.proxy.proxy_server.prisma_client") as mock_prisma:
mock_prisma.db.litellm_agentstable.find_unique = AsyncMock(
return_value=MagicMock(spend=0.0)
)
resp = self.internal_client.get(
"/v1/agents/agent-123", headers={"Authorization": "Bearer k"}
)