litellm/tests/unit/integrations/lens/test_config.py
ishaan-j-berri 1dda4cce51
feat(lens): add key and team tracing controls (#53191)
* feat(lens): add key and team tracing controls

* fix(lens): show unknown when inherited tracing status is unavailable

* fix(docker): include the Lens UI artifact before dashboard install

* test(ui): include team lookup in virtual key mocks

* fix(lens): honor tracing opt-out for passthrough and MCP

* test(passthrough): use authenticated key fixtures

* docs(lens): document lens_enabled on /key/update

Co-Authored-By: Ishaan Jaffer <155045088+ishaan-berri@users.noreply.github.com>

* fix(ui): drop unused LensTabTrigger import

Co-Authored-By: Ishaan Jaffer <155045088+ishaan-berri@users.noreply.github.com>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Ishaan Jaffer <155045088+ishaan-berri@users.noreply.github.com>
2026-11-23 17:59:37 +00:00

23 lines
917 B
Python

import pytest
@pytest.mark.parametrize(
"settings,environ,enabled",
(
(None, {}, False),
({"store": {"type": "clickhouse"}}, {}, False),
({"store": {"type": "lens"}}, {}, True),
({"store": "lens"}, {}, False),
(None, {"LITELLM_LENS_URL": "http://lens"}, True),
(None, {"LITELLM_LENS_PUBLIC_URL": "http://lens"}, False),
(None, {"LITELLM_LENS_SERVICE_TOKEN": "configured-service-token"}, False),
(None, {"LENS_GATEWAY_SECRET": "configured-signing-secret"}, False),
),
)
def test_lens_enablement_requires_its_service_or_an_explicit_lens_store(
settings: object, environ: dict[str, str], enabled: bool
) -> None:
from litellm.integrations.lens.config import LensController, is_lens_tracing_enabled
assert is_lens_tracing_enabled(settings, environ) is enabled
assert LensController.is_lens_setup(settings, environ) is enabled