mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-27 01:22:18 +00:00
* ci: fix the litellm-tests unit job with sysmon coverage, an env allowlist and coverage upload on failure * test: replace key-dependent proxy, enterprise and mcp unit tests with synthetic values and integration and e2e coverage * test: drop key reads at the legacy proxy, enterprise and mcp paths and wire the gemini pass-through split * ci: move caching, proxy-extras, gateway and enterprise tests into tests/unit and run them from litellm-tests under their legacy flags * ci: move caching, proxy-extras, gateway and enterprise tests into tests/unit and run them from litellm-tests under their legacy flags * ci: move tests/proxy_unit_tests to tests/unit/proxy and run the proxy-db shards from litellm-tests * ci: fail the unit shard when circleci tests split errors * test: drop restating comments from the gemini pass-through split * build: point the local proxy unit targets at the nested tests/unit/proxy tree * ci: exit the unit shard cleanly when circleci tests split assigns it no files --------- Co-authored-by: yuneng <yuneng@berri.ai>
52 lines
1.6 KiB
Python
52 lines
1.6 KiB
Python
import os
|
|
|
|
|
|
import httpx
|
|
import pytest
|
|
|
|
from litellm.proxy.proxy_server import app
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_get_favicon_default():
|
|
"""Test that get_favicon returns the default favicon when no URL set."""
|
|
os.environ.pop("LITELLM_FAVICON_URL", None)
|
|
|
|
async with httpx.AsyncClient(
|
|
transport=httpx.ASGITransport(app=app), base_url="http://testserver"
|
|
) as ac:
|
|
response = await ac.get("/get_favicon")
|
|
|
|
assert response.status_code in [200, 404]
|
|
if response.status_code == 200:
|
|
assert response.headers["content-type"] == "image/x-icon"
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_get_favicon_with_custom_url(monkeypatch):
|
|
"""Test that get_favicon redirects browser-loaded custom URLs."""
|
|
monkeypatch.setenv("LITELLM_FAVICON_URL", "https://example.com/favicon.ico")
|
|
|
|
async with httpx.AsyncClient(
|
|
transport=httpx.ASGITransport(app=app),
|
|
base_url="http://testserver",
|
|
) as ac:
|
|
response = await ac.get("/get_favicon")
|
|
|
|
assert response.status_code == 307
|
|
assert response.headers["location"] == "https://example.com/favicon.ico"
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_get_favicon_remote_url_is_not_server_fetched(monkeypatch):
|
|
"""Test that get_favicon does not validate remote URLs server-side."""
|
|
monkeypatch.setenv("LITELLM_FAVICON_URL", "https://invalid.com/favicon.ico")
|
|
|
|
async with httpx.AsyncClient(
|
|
transport=httpx.ASGITransport(app=app),
|
|
base_url="http://testserver",
|
|
) as ac:
|
|
response = await ac.get("/get_favicon")
|
|
|
|
assert response.status_code == 307
|
|
assert response.headers["location"] == "https://invalid.com/favicon.ico"
|