mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-14 23:21:35 +00:00
test: cover none client credential pruning
This commit is contained in:
parent
38f6c7f83f
commit
5328a06ea8
2 changed files with 28 additions and 1 deletions
|
|
@ -69,7 +69,9 @@ def is_clientside_credential(request_kwargs: dict) -> bool:
|
|||
"""
|
||||
Check if the credential is a clientside credential.
|
||||
"""
|
||||
return any(request_kwargs.get(key) is not None for key in clientside_credential_keys)
|
||||
return any(
|
||||
request_kwargs.get(key) is not None for key in clientside_credential_keys
|
||||
)
|
||||
|
||||
|
||||
def get_dynamic_litellm_params(litellm_params: dict, request_kwargs: dict) -> dict:
|
||||
|
|
|
|||
|
|
@ -14,6 +14,31 @@ sys.path.insert(
|
|||
import litellm
|
||||
|
||||
|
||||
def test_router_drops_none_clientside_credentials_from_kwargs():
|
||||
deployment = {
|
||||
"litellm_params": {
|
||||
"model": "azure/gpt-5.4",
|
||||
"api_base": "https://deployment-resource.cognitiveservices.azure.com",
|
||||
"api_key": "deployment-key",
|
||||
}
|
||||
}
|
||||
kwargs = {
|
||||
"api_base": None,
|
||||
"api_key": None,
|
||||
"base_url": None,
|
||||
"request_timeout": 30,
|
||||
}
|
||||
|
||||
litellm.Router._drop_none_clientside_credentials_from_kwargs(
|
||||
deployment=deployment, kwargs=kwargs
|
||||
)
|
||||
|
||||
assert "api_base" not in kwargs
|
||||
assert "api_key" not in kwargs
|
||||
assert kwargs["base_url"] is None
|
||||
assert kwargs["request_timeout"] == 30
|
||||
|
||||
|
||||
def test_update_kwargs_does_not_mutate_defaults_and_merges_metadata():
|
||||
# initialize a real Router (env‑vars can be empty)
|
||||
router = litellm.Router(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue