Files
FabledSteward/tests/test_templates_parse.py
T
bvandeusen 95ebdf7045
CI / lint (push) Successful in 2s
CI / unit (push) Successful in 45s
CI / integration (push) Successful in 2m18s
CI / publish (push) Successful in 1m18s
feat(ui): replace flat top nav with a grouped left sidebar (slice 1)
The flat top bar was a set of ungrouped peers and gave plugin data no home.
Move to a persistent left sidebar with grouped sections, per the navigation
redesign (operator-chosen shell).

- base.html: top <nav> → left <aside class="sidebar"> + content column.
  Groups: Overview (Dashboard, Status), Infrastructure (Hosts; plugin links
  arrive in slice 2), Monitoring (Monitors, Alerts), Automation (Ansible),
  Admin (Settings, Audit; admin-only). Brand on top, user/logout at the bottom.
- Active link highlighted by request.path prefix (aria-current).
- Responsive: sidebar slides off-canvas under 900px via a ☰ toggle + scrim
  (inline class toggle, no new JS deps). Candle-glow preserved.
- Logged-out pages (login/setup) render without the sidebar (gated on
  session.user_id), content area full-width and centered as before.
- Add tests/test_templates_parse.py: syntax-parses every steward template so a
  broken tag fails the unit lane (only the login page renders there today).

Plugin nav links (Docker/SNMP/UniFi/Traefik) come next in slice 2 via a get_nav
hook. UI-only; no behavior/route changes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016Jg27rgypiW2efULXJDtMC
2026-06-19 15:34:47 -04:00

23 lines
772 B
Python

"""Syntax-parse every first-party template so a broken tag fails the unit lane.
The app only renders a handful of templates in unit tests (e.g. the login page),
so a Jinja syntax error elsewhere would otherwise ship green. env.parse() checks
syntax without resolving extends/includes/imports — enough to catch an unbalanced
or mistyped tag across the whole template tree (e.g. the base.html layout).
"""
import pathlib
import jinja2
import steward
_ROOT = pathlib.Path(steward.__file__).parent / "templates"
def test_all_steward_templates_parse():
env = jinja2.Environment()
files = sorted(_ROOT.rglob("*.html"))
assert files, "no steward templates found"
for f in files:
env.parse(f.read_text()) # raises TemplateSyntaxError on a bad tag