From 8ce7767bdf6b8a6d5d2ecf65da44f8da7fafe19d Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Thu, 29 Oct 2026 13:13:51 -0700 Subject: [PATCH] test(proxy): build the transcription file-cap test on a real router so it holds after the router refactor --- tests/unit/proxy/proxy_server/test_routes_audio.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/unit/proxy/proxy_server/test_routes_audio.py b/tests/unit/proxy/proxy_server/test_routes_audio.py index 27ba308b9ec..59d9490f786 100644 --- a/tests/unit/proxy/proxy_server/test_routes_audio.py +++ b/tests/unit/proxy/proxy_server/test_routes_audio.py @@ -16,6 +16,7 @@ import httpx import pytest from fastapi import HTTPException +from litellm import Router from litellm.proxy import proxy_server from litellm.proxy._types import ProxyErrorTypes, ProxyException from litellm.types.llms.openai import HttpxBinaryResponseContent @@ -257,9 +258,12 @@ def test_audio_transcription_over_the_file_size_cap_is_rejected_as_a_bad_request ): from litellm.proxy.common_utils.http_parsing_utils import check_file_size_under_limit - proxy_server.llm_router.get_deployment_by_model_group_name.return_value = MagicMock( - litellm_params=MagicMock(max_file_size_mb=0.000001) + capped_router = Router( + model_list=[ + {"model_name": "whisper-1", "litellm_params": {"model": "openai/whisper-1", "max_file_size_mb": 0.000001}} + ] ) + monkeypatch.setattr(proxy_server, "llm_router", capped_router) monkeypatch.setattr(proxy_server, "premium_user", True) monkeypatch.setattr(proxy_server, "check_file_size_under_limit", check_file_size_under_limit) files = {"file": ("audio.mp3", b"\x00\x01\x02", "audio/mpeg")}