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
fix: test_update_ui_settings_allowlisted_value
Sameer Kankute865c7a2215ae
diff --git a/tests/test_litellm/proxy/ui_crud_endpoints/test_proxy_setting_endpoints.py b/tests/test_litellm/proxy/ui_crud_endpoints/test_proxy_setting_endpoints.pyindex 8fdfd6897a8..ad4f53dac4b 100644--- a/tests/test_litellm/proxy/ui_crud_endpoints/test_proxy_setting_endpoints.py+++ b/tests/test_litellm/proxy/ui_crud_endpoints/test_proxy_setting_endpoints.py@@ -742,18 +742,16 @@ class TestProxySettingEndpoints:):"""Test updating UI settings with an allowlisted field"""from unittest.mock import AsyncMock, MagicMock+ from litellm.proxy.auth.user_api_key_auth import user_api_key_auth+ from litellm.proxy._types import UserAPIKeyAuth- class MockUser:- def __init__(self, user_role):- self.user_role = user_role-- async def mock_admin_auth():- return MockUser(LitellmUserRoles.PROXY_ADMIN)-- monkeypatch.setattr(- "litellm.proxy.ui_crud_endpoints.proxy_setting_endpoints.user_api_key_auth",- mock_admin_auth,+ # Override the FastAPI dependency with a proper mock+ mock_user_auth = UserAPIKeyAuth(+ user_id="test-user-123",+ user_role=LitellmUserRoles.PROXY_ADMIN,)+ app.dependency_overrides[user_api_key_auth] = lambda: mock_user_auth+monkeypatch.setattr("litellm.proxy.proxy_server.store_model_in_db", True)mock_prisma = MagicMock()mock_prisma.db.litellm_uisettings.upsert = AsyncMock()@@ -761,7 +759,11 @@ class TestProxySettingEndpoints:payload = {"disable_model_add_for_internal_users": True}- response = client.patch("/update/ui_settings", json=payload)+ try:+ response = client.patch("/update/ui_settings", json=payload)+ finally:+ # Clean up the dependency override+ app.dependency_overrides.clear()assert response.status_code == 200data = response.json()@@ -780,18 +782,16 @@ class TestProxySettingEndpoints:):"""Test non-allowlisted UI settings are ignored on update"""from unittest.mock import AsyncMock, MagicMock+ from litellm.proxy.auth.user_api_key_auth import user_api_key_auth+ from litellm.proxy._types import UserAPIKeyAuth- class MockUser:- def __init__(self, user_role):- self.user_role = user_role-- async def mock_admin_auth():- return MockUser(LitellmUserRoles.PROXY_ADMIN)-- monkeypatch.setattr(- "litellm.proxy.ui_crud_endpoints.proxy_setting_endpoints.user_api_key_auth",- mock_admin_auth,+ # Override the FastAPI dependency with a proper mock+ mock_user_auth = UserAPIKeyAuth(+ user_id="test-user-123",+ user_role=LitellmUserRoles.PROXY_ADMIN,)+ app.dependency_overrides[user_api_key_auth] = lambda: mock_user_auth+monkeypatch.setattr("litellm.proxy.proxy_server.store_model_in_db", True)mock_prisma = MagicMock()mock_prisma.db.litellm_uisettings.upsert = AsyncMock()@@ -802,7 +802,11 @@ class TestProxySettingEndpoints:"unsupported_flag": True,}- response = client.patch("/update/ui_settings", json=payload)+ try:+ response = client.patch("/update/ui_settings", json=payload)+ finally:+ # Clean up the dependency override+ app.dependency_overrides.clear()assert response.status_code == 200data = response.json()