From b11e46fffea3794f1d0841d695551621893ca2d8 Mon Sep 17 00:00:00 2001 From: Genmin Date: Thu, 30 Apr 2026 10:11:37 -0700 Subject: [PATCH] test: isolate org mcp permission regressions --- .../mcp_server/test_jwt_mcp_enforcement.py | 23 ++++++++++++------- .../test_team_endpoints.py | 1 + 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_jwt_mcp_enforcement.py b/tests/test_litellm/proxy/_experimental/mcp_server/test_jwt_mcp_enforcement.py index c2e42d2f592..259bf36afc5 100644 --- a/tests/test_litellm/proxy/_experimental/mcp_server/test_jwt_mcp_enforcement.py +++ b/tests/test_litellm/proxy/_experimental/mcp_server/test_jwt_mcp_enforcement.py @@ -511,12 +511,19 @@ async def test_e2e_jwt_team_mcp_key_intersection(monkeypatch): ) as mock_access_groups: mock_access_groups.return_value = [] - allowed_servers = await MCPRequestHandler.get_allowed_mcp_servers( - user_api_key_auth - ) + with patch.object( + MCPRequestHandler, "_get_allowed_mcp_servers_for_org" + ) as mock_org_servers: + mock_org_servers.return_value = [] - # Should be intersection: only server-2 is in both - expected = ["server-2"] - assert sorted(allowed_servers) == sorted( - expected - ), f"Expected intersection {expected}, got {allowed_servers}" + allowed_servers = ( + await MCPRequestHandler.get_allowed_mcp_servers( + user_api_key_auth + ) + ) + + # Should be intersection: only server-2 is in both + expected = ["server-2"] + assert sorted(allowed_servers) == sorted( + expected + ), f"Expected intersection {expected}, got {allowed_servers}" diff --git a/tests/test_litellm/proxy/management_endpoints/test_team_endpoints.py b/tests/test_litellm/proxy/management_endpoints/test_team_endpoints.py index e668672dd2a..cdf4501431f 100644 --- a/tests/test_litellm/proxy/management_endpoints/test_team_endpoints.py +++ b/tests/test_litellm/proxy/management_endpoints/test_team_endpoints.py @@ -5477,6 +5477,7 @@ async def test_update_team_guardrails_with_org_id(): mock_prisma.db.litellm_teamtable.find_unique = AsyncMock( return_value=mock_existing_team ) + mock_cache.async_get_cache = AsyncMock(return_value=None) mock_cache.async_set_cache = AsyncMock() # Mock organization fetch - this is where the bug occurred