From bde16ff5b7d406da5a9a55cc880703a7e41c2479 Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Thu, 4 Jun 2026 14:11:44 +0530 Subject: [PATCH] test(proxy): patch utils.get_server_root_path in passthrough auth tests After removing get_server_root_path from pass_through_endpoints, route and JWT tests must mock litellm.proxy.utils where normalization reads it. Co-authored-by: Cursor --- tests/test_litellm/proxy/auth/test_handle_jwt.py | 2 +- tests/test_litellm/proxy/auth/test_route_checks.py | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/test_litellm/proxy/auth/test_handle_jwt.py b/tests/test_litellm/proxy/auth/test_handle_jwt.py index 14119f7ad4e..3b32b4c1c8a 100644 --- a/tests/test_litellm/proxy/auth/test_handle_jwt.py +++ b/tests/test_litellm/proxy/auth/test_handle_jwt.py @@ -233,7 +233,7 @@ async def test_find_team_with_model_access_uses_request_method_for_passthrough_a mock_registered_routes, ), patch( - "litellm.proxy.pass_through_endpoints.pass_through_endpoints.get_server_root_path", + "litellm.proxy.utils.get_server_root_path", return_value="/", ), ): diff --git a/tests/test_litellm/proxy/auth/test_route_checks.py b/tests/test_litellm/proxy/auth/test_route_checks.py index ad9295d6b19..9863b643e50 100644 --- a/tests/test_litellm/proxy/auth/test_route_checks.py +++ b/tests/test_litellm/proxy/auth/test_route_checks.py @@ -733,7 +733,7 @@ def test_virtual_key_llm_api_routes_allows_registered_pass_through_endpoints(): mock_registered_routes, ), patch( - "litellm.proxy.pass_through_endpoints.pass_through_endpoints.get_server_root_path", + "litellm.proxy.utils.get_server_root_path", return_value="/", ), ): @@ -799,7 +799,7 @@ def test_virtual_key_llm_api_routes_allows_non_auth_enforced_pass_through_endpoi mock_registered_routes, ), patch( - "litellm.proxy.pass_through_endpoints.pass_through_endpoints.get_server_root_path", + "litellm.proxy.utils.get_server_root_path", return_value="/", ), ): @@ -849,7 +849,7 @@ def test_virtual_key_llm_api_routes_denies_auth_pass_through_without_allowlist() mock_registered_routes, ), patch( - "litellm.proxy.pass_through_endpoints.pass_through_endpoints.get_server_root_path", + "litellm.proxy.utils.get_server_root_path", return_value="/", ), ): @@ -893,7 +893,7 @@ def test_virtual_key_llm_api_routes_uses_method_specific_auth_setting(): mock_registered_routes, ), patch( - "litellm.proxy.pass_through_endpoints.pass_through_endpoints.get_server_root_path", + "litellm.proxy.utils.get_server_root_path", return_value="/", ), ): @@ -948,7 +948,7 @@ def test_non_proxy_admin_denies_auth_pass_through_without_allowlist(): mock_registered_routes, ), patch( - "litellm.proxy.pass_through_endpoints.pass_through_endpoints.get_server_root_path", + "litellm.proxy.utils.get_server_root_path", return_value="/", ), ): @@ -987,7 +987,7 @@ def test_non_proxy_admin_allows_auth_pass_through_with_team_allowlist(): mock_registered_routes, ), patch( - "litellm.proxy.pass_through_endpoints.pass_through_endpoints.get_server_root_path", + "litellm.proxy.utils.get_server_root_path", return_value="/", ), ): @@ -1021,7 +1021,7 @@ def test_virtual_key_without_llm_api_routes_cannot_access_pass_through(): mock_registered_routes, ), patch( - "litellm.proxy.pass_through_endpoints.pass_through_endpoints.get_server_root_path", + "litellm.proxy.utils.get_server_root_path", return_value="/", ), ):