mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-06 02:48:13 +00:00
test(proxy): cover non-dict router_settings_override
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
0715efc444
commit
01f2e49096
1 changed files with 21 additions and 0 deletions
|
|
@ -1350,3 +1350,24 @@ async def test_route_request_router_settings_override_stripped_with_api_key_or_b
|
|||
call_kwargs = llm_router.acompletion.call_args[1]
|
||||
assert "router_settings_override" not in call_kwargs
|
||||
assert call_kwargs["num_retries"] == 2
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.parametrize("bad_override", [None, "not-a-dict", ["num_retries"]])
|
||||
async def test_route_request_router_settings_override_non_dict_is_stripped_and_ignored(bad_override):
|
||||
"""A malformed override is dropped from the body and applies no settings."""
|
||||
data = {
|
||||
"model": "gpt-3.5-turbo",
|
||||
"messages": [{"role": "user", "content": "Hello"}],
|
||||
"router_settings_override": bad_override,
|
||||
}
|
||||
|
||||
llm_router = MagicMock()
|
||||
llm_router.acompletion.return_value = "success"
|
||||
|
||||
response = await route_request(data, llm_router, None, "acompletion")
|
||||
|
||||
assert response == "success"
|
||||
call_kwargs = llm_router.acompletion.call_args[1]
|
||||
assert "router_settings_override" not in call_kwargs
|
||||
assert "num_retries" not in call_kwargs
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue