test(batches): assert filtered list_batches bypass managed files

This commit is contained in:
Lavya Tandel 2026-08-08 13:53:36 +05:30
parent 4720ff448a
commit 99f7b23efd

View file

@ -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