38 lines
1.6 KiB
Python
38 lines
1.6 KiB
Python
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
JS = (ROOT / "hockey_data" / "static" / "tournament-menu.js").read_text(encoding="utf-8")
|
|
ROUTER = (ROOT / "hockey_data" / "router.py").read_text(encoding="utf-8")
|
|
CSS = (ROOT / "hockey_data" / "static" / "tournament-menu.css").read_text(encoding="utf-8")
|
|
|
|
|
|
def test_connection_diagnostics_are_admin_only():
|
|
assert '@router.get("/admin/connection-diagnostics", dependencies=admin)' in ROUTER
|
|
assert 'service.database.engine.connect()' in ROUTER
|
|
assert 'service.test_connection()' in ROUTER
|
|
assert 'agent_hub.list_mapping_devices()' in ROUTER
|
|
assert 'required_for_match_selection' in ROUTER
|
|
assert 'required_for_remote_sync' in ROUTER
|
|
|
|
|
|
def test_runtime_knows_admin_before_rendering_navigation():
|
|
assert 'state.isAdmin = Boolean(user?.is_admin);' in JS
|
|
assert 'await ensureAccountScopedRuntimeState();\n ensureShell();' in JS
|
|
assert '${state.isAdmin ? `' in JS
|
|
assert 'data-open-connection-diagnostics' in JS
|
|
assert 'data-open-settings' in JS
|
|
|
|
|
|
def test_non_admin_does_not_get_misleading_connection_setup_warning():
|
|
assert ': state.isAdmin\n ? t("notConfigured")\n : t("noGamesLoaded")' in JS
|
|
assert 'if (!state.isAdmin) return;' in JS
|
|
|
|
|
|
def test_failed_match_can_be_diagnosed_with_deep_probe():
|
|
assert 'lastAttemptedGameId' in JS
|
|
assert 'lastGameOpenError' in JS
|
|
assert 'data-match-error-diagnostics' in JS
|
|
assert 'showConnectionDiagnostics({ deep: true })' in JS
|
|
assert 'deep: deep ? "true" : "false"' in JS
|
|
assert '.hockey-connection-diagnostics-card' in CSS
|