Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

cover cli sso start validation

user19ca420056bd
diff --git a/tests/test_litellm/proxy/auth/test_cli_auth.py b/tests/test_litellm/proxy/auth/test_cli_auth.py
index 123b235b363..a4f72ef90ef 100644
--- a/tests/test_litellm/proxy/auth/test_cli_auth.py
+++ b/tests/test_litellm/proxy/auth/test_cli_auth.py
@@ -11,6 +11,7 @@ from litellm.proxy.client.cli.commands.auth import (
_normalize_teams,
_poll_for_ready_data,
_poll_for_authentication,
+ _start_cli_sso_flow,
)
@@ -57,6 +58,18 @@ async def test_normalize_teams_with_details_with_aliases():
]
+@patch("litellm.proxy.client.cli.commands.auth.requests.post")
+def test_start_cli_sso_flow_rejects_invalid_response(request_mock):
+ """Test CLI SSO start rejects malformed server responses"""
+ response = Mock()
+ response.raise_for_status = Mock()
+ response.json.return_value = {"login_id": "cli-session", "user_code": "ABCD-EFGH"}
+ request_mock.return_value = response
+
+ with pytest.raises(ValueError, match="Invalid CLI SSO start response"):
+ _start_cli_sso_flow("https://litellm.com")
+
+
@pytest.mark.asyncio
@patch(
"litellm.proxy.client.cli.commands.auth.requests.get",