From 11be22338d128a6e4b2bea54b8f0d9a40c004b8e Mon Sep 17 00:00:00 2001 From: spawrks Date: Tue, 18 Aug 2026 15:42:42 -0500 Subject: [PATCH] test(proxy): cover response storage normalization --- .../test_proxy_config_unit_test.py | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/proxy_unit_tests/test_proxy_config_unit_test.py b/tests/proxy_unit_tests/test_proxy_config_unit_test.py index 98ee0969f8c..909acfdceb7 100644 --- a/tests/proxy_unit_tests/test_proxy_config_unit_test.py +++ b/tests/proxy_unit_tests/test_proxy_config_unit_test.py @@ -365,3 +365,28 @@ class TestYamlStorePromptsDbOverride: ) assert test_general_settings["store_responses_in_spend_logs"] is False + + @pytest.mark.asyncio + @pytest.mark.parametrize( + ("db_value", "expected"), + [ + (None, None), + (True, True), + ("TRUE", True), + (0, False), + ], + ) + async def test_response_storage_db_value_is_normalized_when_yaml_omits_key( + self, + db_value, + expected, + ): + proxy_config = self._make_proxy_config_with_yaml_keys({"master_key"}) + test_general_settings = {"master_key": "sk-test"} + + with mock.patch("litellm.proxy.proxy_server.general_settings", test_general_settings): + await proxy_config._update_general_settings( + db_general_settings={"store_responses_in_spend_logs": db_value}, + ) + + assert test_general_settings["store_responses_in_spend_logs"] is expected