From 83717d6883eda6ca044c48fd0a0a9dd39e896967 Mon Sep 17 00:00:00 2001 From: mateo Date: Thu, 8 Oct 2026 05:13:55 +0000 Subject: [PATCH] test(proxy): use frozen config in pass-through and debug report tests Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- tests/unit/proxy/common_utils/test_debug_utils.py | 4 ++-- .../pass_through_endpoints/test_pass_through_endpoints.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/unit/proxy/common_utils/test_debug_utils.py b/tests/unit/proxy/common_utils/test_debug_utils.py index a64c94c2991..e1fcf1e409d 100644 --- a/tests/unit/proxy/common_utils/test_debug_utils.py +++ b/tests/unit/proxy/common_utils/test_debug_utils.py @@ -10,7 +10,7 @@ from fastapi import FastAPI from fastapi.testclient import TestClient from litellm.proxy import proxy_server -from litellm.proxy._types import LitellmUserRoles, UserAPIKeyAuth +from litellm.proxy._types import LitellmUserRoles, ProxyRuntimeConfig, UserAPIKeyAuth from litellm.proxy.auth.user_api_key_auth import user_api_key_auth from litellm.proxy.bug_report_config import build_proxy_bug_report from litellm.proxy.common_utils.debug_utils import ( @@ -104,7 +104,7 @@ HOSTILE_STRINGS = ("acme", "sk-live-secret", "hunter2", "10.0.0.7", "azure.com") @pytest.fixture def hostile_proxy_config(monkeypatch: pytest.MonkeyPatch) -> Iterator[None]: previous_config = proxy_server.proxy_config.get_config_state() - proxy_server.proxy_config.update_config_state(config=HOSTILE_CONFIG) + proxy_server.proxy_config.update_config_state(config=ProxyRuntimeConfig.from_resolved(HOSTILE_CONFIG)) monkeypatch.setattr(proxy_server, "general_settings", dict(HOSTILE_GENERAL_SETTINGS)) yield proxy_server.proxy_config.update_config_state(config=previous_config) diff --git a/tests/unit/proxy/pass_through_endpoints/test_pass_through_endpoints.py b/tests/unit/proxy/pass_through_endpoints/test_pass_through_endpoints.py index cd279a6ed4b..527a7acdf0c 100644 --- a/tests/unit/proxy/pass_through_endpoints/test_pass_through_endpoints.py +++ b/tests/unit/proxy/pass_through_endpoints/test_pass_through_endpoints.py @@ -8178,7 +8178,9 @@ async def test_a_settings_write_keeps_the_config_file_pass_throughs(tmp_path, mo config: Final = await proxy.proxy_config.get_config(config_file_path=proxy.config_path) await proxy.proxy_config.save_config( - new_config={**config, "general_settings": {**config["general_settings"], "max_parallel_requests": 7}} + new_config=config.with_section( + "general_settings", {**config.general_settings, "max_parallel_requests": 7} + ) ) saved_general_settings: Final = yaml.safe_load(open(proxy.config_path))["general_settings"]