Fixing tests

This commit is contained in:
yuneng-jiang
2025-12-23 14:10:41 -08:00
parent 87337abfea
commit d9bcc33ba7
@@ -21,7 +21,7 @@ def test_ui_discovery_endpoints_with_defaults():
with patch("litellm.proxy.utils.get_server_root_path", return_value="/"), \
patch("litellm.proxy.utils.get_proxy_base_url", return_value=None), \
patch("litellm.proxy.auth.auth_utils._has_user_setup_sso", return_value=False), \
patch.dict(os.environ, {}, clear=False):
patch.dict(os.environ, {"DISABLE_ADMIN_UI": "false"}, clear=False):
response = client.get("/.well-known/litellm-ui-config")
@@ -41,7 +41,7 @@ def test_ui_discovery_endpoints_with_custom_server_root_path():
with patch("litellm.proxy.utils.get_server_root_path", return_value="/litellm"), \
patch("litellm.proxy.utils.get_proxy_base_url", return_value=None), \
patch("litellm.proxy.auth.auth_utils._has_user_setup_sso", return_value=False), \
patch.dict(os.environ, {}, clear=False):
patch.dict(os.environ, {"DISABLE_ADMIN_UI": "false"}, clear=False):
response = client.get("/.well-known/litellm-ui-config")
@@ -60,7 +60,7 @@ def test_ui_discovery_endpoints_with_proxy_base_url_when_set():
with patch("litellm.proxy.utils.get_server_root_path", return_value="/"), \
patch("litellm.proxy.utils.get_proxy_base_url", return_value="https://proxy.example.com"), \
patch("litellm.proxy.auth.auth_utils._has_user_setup_sso", return_value=False), \
patch.dict(os.environ, {}, clear=False):
patch.dict(os.environ, {"DISABLE_ADMIN_UI": "false"}, clear=False):
response = client.get("/litellm/.well-known/litellm-ui-config")
@@ -79,7 +79,7 @@ def test_ui_discovery_endpoints_with_sso_configured_and_auto_redirect_enabled():
with patch("litellm.proxy.utils.get_server_root_path", return_value="/litellm"), \
patch("litellm.proxy.utils.get_proxy_base_url", return_value="https://proxy.example.com"), \
patch("litellm.proxy.auth.auth_utils._has_user_setup_sso", return_value=True), \
patch.dict(os.environ, {"AUTO_REDIRECT_UI_LOGIN_TO_SSO": "true"}, clear=False):
patch.dict(os.environ, {"AUTO_REDIRECT_UI_LOGIN_TO_SSO": "true", "DISABLE_ADMIN_UI": "false"}, clear=False):
response = client.get("/.well-known/litellm-ui-config")
@@ -98,7 +98,7 @@ def test_ui_discovery_endpoints_with_sso_configured_but_auto_redirect_disabled()
with patch("litellm.proxy.utils.get_server_root_path", return_value="/litellm"), \
patch("litellm.proxy.utils.get_proxy_base_url", return_value="https://proxy.example.com"), \
patch("litellm.proxy.auth.auth_utils._has_user_setup_sso", return_value=True), \
patch.dict(os.environ, {"AUTO_REDIRECT_UI_LOGIN_TO_SSO": "false"}, clear=False):
patch.dict(os.environ, {"AUTO_REDIRECT_UI_LOGIN_TO_SSO": "false", "DISABLE_ADMIN_UI": "false"}, clear=False):
response = client.get("/.well-known/litellm-ui-config")
@@ -117,7 +117,7 @@ def test_ui_discovery_endpoints_with_sso_not_configured_but_auto_redirect_enable
with patch("litellm.proxy.utils.get_server_root_path", return_value="/"), \
patch("litellm.proxy.utils.get_proxy_base_url", return_value=None), \
patch("litellm.proxy.auth.auth_utils._has_user_setup_sso", return_value=False), \
patch.dict(os.environ, {"AUTO_REDIRECT_UI_LOGIN_TO_SSO": "true"}, clear=False):
patch.dict(os.environ, {"AUTO_REDIRECT_UI_LOGIN_TO_SSO": "true", "DISABLE_ADMIN_UI": "false"}, clear=False):
response = client.get("/.well-known/litellm-ui-config")
@@ -136,7 +136,7 @@ def test_ui_discovery_endpoints_both_routes_return_same_data():
with patch("litellm.proxy.utils.get_server_root_path", return_value="/litellm"), \
patch("litellm.proxy.utils.get_proxy_base_url", return_value="https://proxy.example.com"), \
patch("litellm.proxy.auth.auth_utils._has_user_setup_sso", return_value=True), \
patch.dict(os.environ, {"AUTO_REDIRECT_UI_LOGIN_TO_SSO": "true"}, clear=False):
patch.dict(os.environ, {"AUTO_REDIRECT_UI_LOGIN_TO_SSO": "true", "DISABLE_ADMIN_UI": "false"}, clear=False):
response1 = client.get("/.well-known/litellm-ui-config")
response2 = client.get("/litellm/.well-known/litellm-ui-config")