The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
test: model the team membership lookup in MCP DCR admission fixtures and assert decisions call types per route (#45917)
devin-ai-integration[bot]5390199d637e
diff --git a/tests/integration/providers/test_databricks_decisions_wire.py b/tests/integration/providers/test_databricks_decisions_wire.pyindex 9b9f54e815d..12065d8c370 100644--- a/tests/integration/providers/test_databricks_decisions_wire.py+++ b/tests/integration/providers/test_databricks_decisions_wire.py@@ -251,7 +251,7 @@ def test_an_openai_format_request_at_v1_decisions_reaches_the_serving_endpoint_arow["model_group"],row["api_base"],_number(row["spend"]),- ) == ("success", "asystemone", "databricks", deployment, f"{handle.api_base()}/{_ENDPOINT}/invocations", 0.0), (+ ) == ("success", "adecisions", "databricks", deployment, f"{handle.api_base()}/{_ENDPOINT}/invocations", 0.0), (row)diff --git a/tests/integration/providers/test_strands_decider_agentcore_wire.py b/tests/integration/providers/test_strands_decider_agentcore_wire.pyindex 493d8c238fa..fc62849db9b 100644--- a/tests/integration/providers/test_strands_decider_agentcore_wire.py+++ b/tests/integration/providers/test_strands_decider_agentcore_wire.py@@ -114,6 +114,12 @@ _OPENAI: Final = _Route("/v1/decisions", {"input": _INPUT, "questions": _OPENAI_QUESTIONS}, _OPENAI_UPSTREAM_BODY, _OPENAI_ANSWER)_ROUTES: Final = (_SYSTEMONE, _OPENAI, replace(_SYSTEMONE, path="/systemone"), replace(_OPENAI, path="/decisions"))+_ROUTE_CALL_TYPES: Final[Mapping[str, str]] = {+ "/v1/systemone": "asystemone",+ "/systemone": "asystemone",+ "/v1/decisions": "adecisions",+ "/decisions": "adecisions",+}_SPEND_QUERY: Final = ("SELECT status, call_type, custom_llm_provider, model_group, api_base, prompt_tokens, completion_tokens "'FROM "LiteLLM_SpendLogs" WHERE request_id = %s'@@ -411,11 +417,11 @@ def test_an_arn_deployment_answers_on_every_decisions_route_signed_for_bedrock_a_assert_runtime_call(call, "audit_signed", route=route)assert call.headers[_SESSION_HEADER] == _default_session("audit_signed"), dict(call.headers)_assert_signed(call)- for response in responses:+ for response, route in zip(responses, _ROUTES, strict=True):row = _spend_row(response.headers["x-litellm-call-id"])assert row == {"status": "success",- "call_type": "asystemone",+ "call_type": _ROUTE_CALL_TYPES[route.path],"custom_llm_provider": "strands_decider","model_group": _SIGNED,"api_base": _invocations_url("audit_signed"),diff --git a/tests/unit/proxy/_experimental/mcp_server/auth/test_user_api_key_auth_mcp.py b/tests/unit/proxy/_experimental/mcp_server/auth/test_user_api_key_auth_mcp.pyindex 6254b1bc44c..078fff0266b 100644--- a/tests/unit/proxy/_experimental/mcp_server/auth/test_user_api_key_auth_mcp.py+++ b/tests/unit/proxy/_experimental/mcp_server/auth/test_user_api_key_auth_mcp.py@@ -6164,7 +6164,8 @@ class TestMCPDcrBridgeDelegateAdmission:policy gates re-check. ``team_blocked=True`` patches the centralized gate's``get_team_object`` at the ``user_api_key_auth`` namespace it actually calls; ``owner``patches the SCIM gate's ``get_user_object`` (``auth_checks`` namespace); ``project_object``- patches the centralized gate's ``get_project_object``. Unpatched lookups hit the MagicMock+ patches the centralized gate's ``get_project_object``. The team-membership lookup is+ patched to "no membership row". Unpatched lookups hit the MagicMockprisma and are swallowed (``_safe_fetch`` / the SCIM gate's fail-open), so their checksskip. Yields the ``get_key_object`` mock so callers can assert the sealed ``key_hash`` wasthe reload key."""@@ -6179,6 +6180,10 @@ class TestMCPDcrBridgeDelegateAdmission:),patch("litellm.proxy.proxy_server.prisma_client", MagicMock()),patch("litellm.proxy.proxy_server.user_api_key_cache", MagicMock()),+ patch(+ "litellm.proxy.auth.user_api_key_auth.get_team_membership",+ AsyncMock(return_value=None),+ ),]if team_blocked:patchers.append(@@ -6206,7 +6211,8 @@ class TestMCPDcrBridgeDelegateAdmission:def _patch_user_reload(*, return_value=None, side_effect=None):"""Patch the user-subject reload path an interactively-minted envelope takes: the``get_user_object`` lookup ``reload_admitted_user`` runs (which also drives the SCIM gate),- plus the ``prisma_client`` / ``user_api_key_cache`` globals. The centralized gate's own+ plus the ``prisma_client`` / ``user_api_key_cache`` globals. The team-membership lookup is+ patched to "no membership row". The centralized gate's ownfetches fail-safe to None under the MagicMock prisma, so an unblocked user admits. Yields the``get_user_object`` mock so a caller can assert the sealed user_id was the reload key."""get_user_object = AsyncMock(return_value=return_value, side_effect=side_effect)@@ -6214,6 +6220,10 @@ class TestMCPDcrBridgeDelegateAdmission:patch("litellm.proxy.auth.auth_checks.get_user_object", get_user_object),patch("litellm.proxy.proxy_server.prisma_client", MagicMock()),patch("litellm.proxy.proxy_server.user_api_key_cache", MagicMock()),+ patch(+ "litellm.proxy.auth.user_api_key_auth.get_team_membership",+ AsyncMock(return_value=None),+ ),):yield get_user_object