From 0b4cb09d6b4a2801862f349c4dce4d828cbb24db Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Wed, 4 Mar 2026 19:35:18 -0800 Subject: [PATCH] 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 --- tests/test_litellm/proxy/agent_endpoints/test_endpoints.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test_litellm/proxy/agent_endpoints/test_endpoints.py b/tests/test_litellm/proxy/agent_endpoints/test_endpoints.py index fcf8f048190..9d1503b5367 100644 --- a/tests/test_litellm/proxy/agent_endpoints/test_endpoints.py +++ b/tests/test_litellm/proxy/agent_endpoints/test_endpoints.py @@ -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"} )