fix: add prisma_client mock to provider error test; move get_user_credential import to module level

This commit is contained in:
Ishaan Jaffer 2026-03-07 16:57:06 -08:00
parent 6dd417e4e4
commit 018872078f
2 changed files with 5 additions and 2 deletions

View file

@ -197,6 +197,7 @@ if MCP_AVAILABLE:
from litellm.proxy._experimental.mcp_server.auth.litellm_auth_handler import (
MCPAuthenticatedUser,
)
from litellm.proxy._experimental.mcp_server.db import get_user_credential
from litellm.proxy._experimental.mcp_server.mcp_server_manager import (
global_mcp_server_manager,
)
@ -1606,7 +1607,6 @@ if MCP_AVAILABLE:
_byok_cred_cache.move_to_end(cache_key) # promote to MRU
return credential
from litellm.proxy._experimental.mcp_server.db import get_user_credential
from litellm.proxy.proxy_server import prisma_client
if prisma_client is None:
@ -1695,7 +1695,6 @@ if MCP_AVAILABLE:
)
return
from litellm.proxy._experimental.mcp_server.db import get_user_credential
from litellm.proxy.proxy_server import prisma_client
if prisma_client is None:

View file

@ -167,6 +167,10 @@ async def test_callback_provider_error_in_json_body():
) as mock_mgr, patch(
"litellm.proxy._experimental.mcp_server.openapi_oauth2_endpoints.get_request_base_url",
return_value="http://localhost:4000",
), patch(
"litellm.proxy.proxy_server.prisma_client",
MagicMock(),
create=True,
), patch(
"httpx.AsyncClient"
) as mock_client_cls: