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
moved test to test_litellm
Achintya Rajan4bebb5761167
diff --git a/tests/proxy_unit_tests/test_proxy_utils.py b/tests/proxy_unit_tests/test_proxy_utils.pyindex 9b01f21c586..4ac54b7780a 100644--- a/tests/proxy_unit_tests/test_proxy_utils.py+++ b/tests/proxy_unit_tests/test_proxy_utils.py@@ -1029,73 +1029,6 @@ def test_update_config_fields():assert team_config["langfuse_secret"] == "my-fake-secret"-def test_update_config_fields_deep_merge_db_wins():- from litellm.proxy.proxy_server import ProxyConfig-- proxy_config = ProxyConfig()-- current_config = {- "router_settings": {- "routing_mode": "cost_optimized",- "model_group_alias": {- # Existing alias with older model + different hidden flag- "claude-sonnet-4": {- "model": "claude-sonnet-4-20240219",- "hidden": True,- },- # An extra alias that should remain untouched unless DB overrides it- "legacy-sonnet": {- "model": "claude-2.1",- "hidden": True,- },- },- }- }-- db_param_value = {- "model_group_alias": {- # Conflict: DB should win (both 'model' and 'hidden')- "claude-sonnet-4": {- "model": "claude-sonnet-4-20250514",- "hidden": False,- },- # New alias to be added by the merge- "claude-sonnet-latest": {- "model": "claude-sonnet-4-20250514",- "hidden": True,- },- # Demonstrate that None values from DB are skipped (preserve existing)- "legacy-sonnet": {- "hidden": None # should not clobber current True- },- }- }-- updated = proxy_config._update_config_fields(- current_config=current_config,- param_name="router_settings",- db_param_value=db_param_value,- )-- rs = updated["router_settings"]- aliases = rs["model_group_alias"]-- # DB wins on conflicts (deep) for existing alias- assert aliases["claude-sonnet-4"]["model"] == "claude-sonnet-4-20250514"- assert aliases["claude-sonnet-4"]["hidden"] is False-- # New alias introduced by DB is present with its values- assert "claude-sonnet-latest" in aliases- assert aliases["claude-sonnet-latest"]["model"] == "claude-sonnet-4-20250514"- assert aliases["claude-sonnet-latest"]["hidden"] is True-- # None in DB does not overwrite existing values- assert aliases["legacy-sonnet"]["model"] == "claude-2.1"- assert aliases["legacy-sonnet"]["hidden"] is True-- # Unrelated router_settings keys are preserved- assert rs["routing_mode"] == "cost_optimized"-def test_update_config_fields_default_internal_user_params(monkeypatch):from litellm.proxy.proxy_server import ProxyConfigdiff --git a/tests/test_litellm/proxy/test_proxy_utils.py b/tests/test_litellm/proxy/test_proxy_utils.pyindex 6997ac65275..89e410af2c3 100644--- a/tests/test_litellm/proxy/test_proxy_utils.py+++ b/tests/test_litellm/proxy/test_proxy_utils.py@@ -19,6 +19,74 @@ from unittest.mock import MagicMockfrom litellm.proxy.utils import get_custom_url+def test_update_config_fields_deep_merge_db_wins():+ from litellm.proxy.proxy_server import ProxyConfig++ proxy_config = ProxyConfig()++ current_config = {+ "router_settings": {+ "routing_mode": "cost_optimized",+ "model_group_alias": {+ # Existing alias with older model + different hidden flag+ "claude-sonnet-4": {+ "model": "claude-sonnet-4-20240219",+ "hidden": True,+ },+ # An extra alias that should remain untouched unless DB overrides it+ "legacy-sonnet": {+ "model": "claude-2.1",+ "hidden": True,+ },+ },+ }+ }++ db_param_value = {+ "model_group_alias": {+ # Conflict: DB should win (both 'model' and 'hidden')+ "claude-sonnet-4": {+ "model": "claude-sonnet-4-20250514",+ "hidden": False,+ },+ # New alias to be added by the merge+ "claude-sonnet-latest": {+ "model": "claude-sonnet-4-20250514",+ "hidden": True,+ },+ # Demonstrate that None values from DB are skipped (preserve existing)+ "legacy-sonnet": {+ "hidden": None # should not clobber current True+ },+ }+ }++ updated = proxy_config._update_config_fields(+ current_config=current_config,+ param_name="router_settings",+ db_param_value=db_param_value,+ )++ rs = updated["router_settings"]+ aliases = rs["model_group_alias"]++ # DB wins on conflicts (deep) for existing alias+ assert aliases["claude-sonnet-4"]["model"] == "claude-sonnet-4-20250514"+ assert aliases["claude-sonnet-4"]["hidden"] is False++ # New alias introduced by DB is present with its values+ assert "claude-sonnet-latest" in aliases+ assert aliases["claude-sonnet-latest"]["model"] == "claude-sonnet-4-20250514"+ assert aliases["claude-sonnet-latest"]["hidden"] is True++ # None in DB does not overwrite existing values+ assert aliases["legacy-sonnet"]["model"] == "claude-2.1"+ assert aliases["legacy-sonnet"]["hidden"] is True++ # Unrelated router_settings keys are preserved+ assert rs["routing_mode"] == "cost_optimized"++def test_get_custom_url(monkeypatch):monkeypatch.setenv("SERVER_ROOT_PATH", "/litellm")custom_url = get_custom_url(request_base_url="http://0.0.0.0:4000", route="ui/")