mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
fix(tests): stop patching an SDK internal in the discovery regression test
TQ008 flagged patching litellm.proxy.auth.model_checks.get_valid_models. Assert the gate's own return value instead of mocking past it.
This commit is contained in:
parent
0ac1c45fdf
commit
3d7d8f69f4
1 changed files with 14 additions and 14 deletions
|
|
@ -809,6 +809,11 @@ def test_get_provider_models_admits_providers_without_a_static_catalog():
|
|||
"""litellm_proxy and hosted_vllm have no entry in litellm.models_by_provider
|
||||
(their model list only exists behind the provider's own endpoint), so the
|
||||
static-dict gate must not reject them before endpoint discovery runs.
|
||||
|
||||
Regression check only, not a discovery test: with check_provider_endpoint
|
||||
left at its default (off), get_valid_models never reaches the network and
|
||||
falls back to models_by_provider.get(provider, []) -- an empty list, not
|
||||
None. Before the fix, the gate itself returned None for these providers.
|
||||
"""
|
||||
import litellm
|
||||
from litellm.proxy.auth.model_checks import get_provider_models
|
||||
|
|
@ -817,21 +822,16 @@ def test_get_provider_models_admits_providers_without_a_static_catalog():
|
|||
assert "litellm_proxy" not in litellm.models_by_provider
|
||||
assert "hosted_vllm" not in litellm.models_by_provider
|
||||
|
||||
with patch(
|
||||
"litellm.proxy.auth.model_checks.get_valid_models",
|
||||
return_value=["litellm_proxy/gpt-4o"],
|
||||
) as mock_get_valid_models:
|
||||
result = get_provider_models(
|
||||
"litellm_proxy",
|
||||
litellm_params=LiteLLM_Params(
|
||||
model="litellm_proxy/*",
|
||||
api_base="http://upstream:4000",
|
||||
api_key="sk-upstream",
|
||||
),
|
||||
)
|
||||
result = get_provider_models(
|
||||
"litellm_proxy",
|
||||
litellm_params=LiteLLM_Params(
|
||||
model="litellm_proxy/*",
|
||||
api_base="http://upstream:4000",
|
||||
api_key="sk-upstream",
|
||||
),
|
||||
)
|
||||
|
||||
assert result == ["litellm_proxy/gpt-4o"]
|
||||
mock_get_valid_models.assert_called_once()
|
||||
assert result == []
|
||||
|
||||
|
||||
def test_get_provider_models_returns_none_for_an_unknown_provider():
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue