From 99f7b23efdbe769acca9298905b4bfbcc53c2716 Mon Sep 17 00:00:00 2001 From: Lavya Tandel Date: Sat, 8 Aug 2026 13:53:36 +0530 Subject: [PATCH] test(batches): assert filtered list_batches bypass managed files --- .../proxy/batches_endpoints/test_endpoints.py | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/tests/test_litellm/proxy/batches_endpoints/test_endpoints.py b/tests/test_litellm/proxy/batches_endpoints/test_endpoints.py index f9193db143e..51cde3ff1e0 100644 --- a/tests/test_litellm/proxy/batches_endpoints/test_endpoints.py +++ b/tests/test_litellm/proxy/batches_endpoints/test_endpoints.py @@ -1485,8 +1485,6 @@ async def test_list__managed_files_path(list_harness): user_api_key_dict=user, limit=7, after="batch-cursor", - provider="openai", - target_model_names="m1,m2", llm_router=list_harness.router, ) list_harness.litellm_alist.assert_not_called() @@ -1494,6 +1492,30 @@ async def test_list__managed_files_path(list_harness): assert resp is page +@pytest.mark.asyncio +async def test_list__managed_files_rejects_provider_filter(list_harness): + """Provider/target_model filters must not enter the managed-files path; + they must fall through to provider/model routing instead. + """ + page = FakeListPage([make_batch(id="batch-1")]) + list_harness.set_managed_files(page) + + user = UserAPIKeyAuth(api_key="sk-test") + resp = await call_list( + list_harness, + user=user, + limit=7, + after="batch-cursor", + provider="openai", + target_model_names="m1,m2", + ) + + # Filtered requests bypass managed-files and use provider fallback. + list_harness.litellm_alist.assert_called_once() + list_harness.router_alist.assert_not_called() + assert list_harness.alist_kwargs()["custom_llm_provider"] == "openai" + + @pytest.mark.asyncio async def test_list__managed_files_beats_model_param(list_harness): """Branch 1 is checked before the model branch: a model in the body does not