From 5f11068f76d77e05519fcc90a7087a2d9ef7fe95 Mon Sep 17 00:00:00 2001 From: mateo <277851410+mateo-berri@users.noreply.github.com> Date: Thu, 12 Nov 2026 13:27:01 +0000 Subject: [PATCH] test(proxy): exercise real setup for allowed s3 media Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../test_pass_through_endpoints.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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 855df362608..53f8213802c 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 @@ -13509,15 +13509,16 @@ async def test_chat_completion_pass_through_endpoint_refuses_an_s3_image_in_an_u @pytest.mark.asyncio -async def test_chat_completion_pass_through_endpoint_forwards_an_s3_image_in_a_listed_bucket( +async def test_chat_completion_pass_through_endpoint_routes_an_s3_image_in_a_listed_bucket( monkeypatch: pytest.MonkeyPatch, ): - proxy_logging: Final = _stub_adapter_proxy(monkeypatch) + monkeypatch.setattr("litellm.proxy.proxy_server.proxy_logging_obj", ProxyLogging(user_api_key_cache=DualCache())) + monkeypatch.setattr("litellm.proxy.proxy_server.llm_router", None) + monkeypatch.setattr("litellm.proxy.proxy_server.user_model", None) monkeypatch.setattr( "litellm.proxy.proxy_server.general_settings", {"allowed_client_side_s3_buckets": ["private-bucket"]} ) - request: Final = MagicMock(spec=Request) - request.body = AsyncMock(return_value=_ADAPTER_BODY_WITH_S3_IMAGE) + request: Final = _request_with_body("application/json", _ADAPTER_BODY_WITH_S3_IMAGE) with pytest.raises(ProxyException) as raised: await chat_completion_pass_through_endpoint( @@ -13527,8 +13528,8 @@ async def test_chat_completion_pass_through_endpoint_forwards_an_s3_image_in_a_l user_api_key_dict=UserAPIKeyAuth(api_key="sk-test"), ) - assert raised.value.code != "403" - proxy_logging.pre_call_hook.assert_awaited_once() + assert raised.value.code == "400" + assert raised.value.message == str(ProxyModelNotFoundError(route="completion", model_name="unknown-model")) @pytest.mark.asyncio