mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-11 03:38:38 +00:00
add test
This commit is contained in:
parent
0586d83c16
commit
f7406b441f
1 changed files with 20 additions and 0 deletions
|
|
@ -2150,6 +2150,26 @@ class TestCLIKeyRegenerationFlow:
|
|||
result=mock_result,
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_auth_callback_raises_on_oauth_error(self):
|
||||
"""Test that auth_callback returns a 401 when the provider redirects with an OAuth error"""
|
||||
from litellm.proxy.management_endpoints.ui_sso import auth_callback
|
||||
|
||||
mock_request = MagicMock(spec=Request)
|
||||
mock_request.query_params = {
|
||||
"error": "access_denied",
|
||||
"error_description": "User denied consent",
|
||||
}
|
||||
|
||||
with pytest.raises(HTTPException) as exc_info:
|
||||
await auth_callback(request=mock_request, state="test-state")
|
||||
|
||||
assert exc_info.value.status_code == 401
|
||||
assert (
|
||||
exc_info.value.detail
|
||||
== "OAuth error: access_denied, error_description: User denied consent"
|
||||
)
|
||||
|
||||
def test_get_redirect_url_does_not_include_existing_key_in_url(self):
|
||||
"""Test that redirect URL generation does NOT include existing_key in URL (uses state parameter instead)"""
|
||||
from litellm.proxy.management_endpoints.ui_sso import SSOAuthenticationHandler
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue