Files
wehub-resource-sync 7a0da7932b
OSV-Scanner (Scheduled) / scan-scheduled (push) Failing after 0s
Create Release / test-gate (push) Has been cancelled
Create Release / release-gate (push) Has been cancelled
Create Release / ci-gate (push) Has been cancelled
Create Release / version-check (push) Has been cancelled
Create Release / e2e-test-gate (push) Has been cancelled
Create Release / responsive-test-gate (push) Has been cancelled
Create Release / compat-test-gate (push) Has been cancelled
Create Release / compose-integration-gate (push) Has been cancelled
Create Release / vulture-gate (push) Has been cancelled
Create Release / build (push) Has been cancelled
Create Release / provenance (push) Has been cancelled
Create Release / prerelease-docker (push) Has been cancelled
Create Release / publish-docker (push) Has been cancelled
Create Release / create-release (push) Has been cancelled
Create Release / cleanup-changelog (push) Has been cancelled
Create Release / trigger-pypi (push) Has been cancelled
Create Release / monitor-pypi (push) Has been cancelled
Create Release / Clean up orphan prerelease tags and signatures (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-form] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-metrics] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-workflow] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [settings-core] (push) Has been cancelled
CodeQL Advanced / Analyze (javascript-typescript) (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [history-news] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [library] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [link-analytics] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [chat-core] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [chat-lifecycle] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [error-benchmark] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [settings-pages] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) (push) Has been cancelled
Docker Tests (Consolidated) / Accessibility Tests (push) Has been cancelled
Docker Tests (Consolidated) / LLM Unit Tests (push) Has been cancelled
Docker Tests (Consolidated) / LLM Example Tests (push) Has been cancelled
Docker Tests (Consolidated) / Production Image Smoke Test (push) Has been cancelled
Docker Tests (Consolidated) / Infrastructure Tests (push) Has been cancelled
OSSF Scorecard / OSSF Security Scorecard Analysis (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [mobile] (push) Has been cancelled
Backwards Compatibility / Verify Encryption Constants (push) Has been cancelled
Backwards Compatibility / PyPI Version Compatibility (push) Has been cancelled
Backwards Compatibility / Database Migration Tests (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Docker Tests (Consolidated) / detect-changes (push) Has been cancelled
Docker Tests (Consolidated) / Build Test Image (push) Has been cancelled
Docker Tests (Consolidated) / All Pytest Tests + Coverage (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [accessibility] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [api-crud] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-login] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-pages] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-register] (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:08:55 +08:00

130 lines
4.0 KiB
Python

"""Tests for theme registry."""
class TestThemeRegistry:
def test_singleton_instance(self):
from local_deep_research.web.themes import ThemeRegistry
r1 = ThemeRegistry()
r2 = ThemeRegistry()
assert r1 is r2
def test_themes_property(self):
from local_deep_research.web.themes import theme_registry
themes = theme_registry.themes
assert isinstance(themes, dict)
assert len(themes) > 0
def test_get_theme_ids(self):
from local_deep_research.web.themes import theme_registry
ids = theme_registry.get_theme_ids()
assert isinstance(ids, list)
assert len(ids) > 0
# Should be sorted
assert ids == sorted(ids)
def test_get_theme(self):
from local_deep_research.web.themes import theme_registry
ids = theme_registry.get_theme_ids()
if ids:
theme = theme_registry.get_theme(ids[0])
assert theme is not None
assert theme.id == ids[0]
def test_get_theme_nonexistent(self):
from local_deep_research.web.themes import theme_registry
theme = theme_registry.get_theme("nonexistent_theme_xyz")
assert theme is None
def test_get_themes_by_group(self):
from local_deep_research.web.themes import theme_registry
grouped = theme_registry.get_themes_by_group()
assert isinstance(grouped, dict)
def test_get_combined_css(self):
from local_deep_research.web.themes import theme_registry
css = theme_registry.get_combined_css()
assert isinstance(css, str)
assert len(css) > 0
assert "Auto-generated" in css
def test_get_themes_json(self):
from local_deep_research.web.themes import theme_registry
json_str = theme_registry.get_themes_json()
assert isinstance(str(json_str), str)
# Should be valid JSON array
import json
parsed = json.loads(str(json_str))
assert isinstance(parsed, list)
def test_get_metadata_json(self):
from local_deep_research.web.themes import theme_registry
json_str = theme_registry.get_metadata_json()
assert isinstance(str(json_str), str)
import json
parsed = json.loads(str(json_str))
assert isinstance(parsed, dict)
def test_get_settings_options(self):
from local_deep_research.web.themes import theme_registry
options = theme_registry.get_settings_options()
assert isinstance(options, list)
for option in options:
assert "label" in option
assert "value" in option
def test_get_grouped_settings_options(self):
from local_deep_research.web.themes import theme_registry
options = theme_registry.get_grouped_settings_options()
assert isinstance(options, list)
for option in options:
assert "label" in option
assert "value" in option
assert "group" in option
def test_is_valid_theme(self):
from local_deep_research.web.themes import theme_registry
ids = theme_registry.get_theme_ids()
if ids:
assert theme_registry.is_valid_theme(ids[0]) is True
assert theme_registry.is_valid_theme("nonexistent_xyz") is False
def test_clear_cache(self):
from local_deep_research.web.themes import theme_registry
# Should not raise
theme_registry.clear_cache()
class TestModuleFunctions:
def test_get_themes_function(self):
from local_deep_research.web.themes import get_themes
themes = get_themes()
assert isinstance(themes, list)
def test_get_themes_json_function(self):
from local_deep_research.web.themes import get_themes_json
json_str = get_themes_json()
assert isinstance(str(json_str), str)
def test_get_theme_metadata_function(self):
from local_deep_research.web.themes import get_theme_metadata
metadata = get_theme_metadata()
assert isinstance(str(metadata), str)