From b23e35f75e005a2b0eac199bb7f2bb6bc16ebff5 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Sat, 23 Aug 2025 12:09:19 -0700 Subject: [PATCH] test: update tests --- litellm/proxy/proxy_server.py | 12 +++++++----- tests/test_litellm/proxy/test_proxy_server.py | 7 +++++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index bccca574b1..547aaf5078 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -2679,12 +2679,14 @@ class ProxyConfig: config_router_settings = config_data.get("router_settings", {}) combined_router_settings = {} - if config_router_settings is not None and isinstance( - config_router_settings, dict - ) and db_router_settings is not None and isinstance( - db_router_settings.param_value, dict + if ( + config_router_settings is not None + and isinstance(config_router_settings, dict) + and db_router_settings is not None + and isinstance(db_router_settings.param_value, dict) ): from litellm.utils import _update_dictionary + combined_router_settings = _update_dictionary( config_router_settings, db_router_settings.param_value ) @@ -2697,7 +2699,7 @@ class ProxyConfig: ): combined_router_settings = db_router_settings.param_value - if combined_router_settings is not None: + if combined_router_settings: llm_router.update_settings(**combined_router_settings) def _add_general_settings_from_db_config( diff --git a/tests/test_litellm/proxy/test_proxy_server.py b/tests/test_litellm/proxy/test_proxy_server.py index 28410edd53..d2b516a55d 100644 --- a/tests/test_litellm/proxy/test_proxy_server.py +++ b/tests/test_litellm/proxy/test_proxy_server.py @@ -1722,8 +1722,11 @@ async def test_add_router_settings_from_db_config_merge_logic(): assert combined_settings["retry_delay"] == 2 # Nested dictionaries should be merged (but this is shallow merge) - # The entire nested_config dict gets replaced by DB value - expected_nested = {"setting2": "db_value2", "setting3": "db_value3"} + expected_nested = { + "setting1": "config_value1", + "setting2": "db_value2", + "setting3": "db_value3", + } assert combined_settings["nested_config"] == expected_nested