The last page of #5214's walk. Settings still described Steward as it was before monitors were unified and SNMP was rebuilt, drew its tabs below the breadcrumb, and showed the report schedule in UTC. - Tabs (#5377): settings/_tabs.html is a settings_tabs() macro called in each page's section_tabs block, above the trail, as Ansible's are. The breadcrumb guard also fails any page that {% include %}s a tab strip. - Report time (#5378): reports.schedule_tz keeps the zone of whoever saved the schedule; check_and_send compares in it (report_due), and the form shows the day and hour on the reader's clock (schedule_in) under their zone's name. "Last sent" uses |when. - Wording (#5379): the report contents list what the report holds (monitors, not ping-enabled hosts); "Ping latency" is "Response time" and says what it grades; plugin detail says enabling loads now and disabling needs a restart; the monitor interval says it applies on the next check (the scheduler reads it every pass); the dead list-config branch is gone. - Traefik (#5380): the 5xx and 4xx cutoffs are settings (traefik.threshold.error_5xx_pct 0.1, error_4xx_pct 1.0) in a "Traefik routers" group on Thresholds while the plugin runs, read by router_state through error_cutoffs(). The Traefik page has a Thresholds button for admins, to /settings/thresholds/#traefik. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
43 lines
1.9 KiB
Python
43 lines
1.9 KiB
Python
"""Settings pages say what Steward does now, in the reader's zone (milestone 493)."""
|
|
from quart import render_template, session
|
|
|
|
from steward.core.settings import DEFAULTS
|
|
|
|
|
|
def _settings(**over):
|
|
return {**DEFAULTS, **over}
|
|
|
|
|
|
async def _render(app, name, path, tz="America/New_York", **ctx):
|
|
async with app.test_request_context(path):
|
|
session["user_role"] = "admin"
|
|
session["tz"] = tz
|
|
return await render_template(name, **ctx)
|
|
|
|
|
|
async def test_reports_name_the_readers_zone_and_what_the_report_holds(app):
|
|
page = await _render(app, "settings/reports.html", "/settings/reports/", settings=_settings(),
|
|
flash=None, shown_day=6, shown_hour=4, last_sent=None)
|
|
assert "UTC" not in page[page.index("<main"):]
|
|
assert "At hour (E" in page # EDT or EST, by the date
|
|
assert '<option value="4" selected>' in page.replace("\n", "").replace(" ", "")
|
|
assert "ping-enabled" not in page and "Monitors down now" in page
|
|
|
|
|
|
async def test_the_traefik_group_shows_only_while_the_plugin_runs(app):
|
|
on = await _render(app, "settings/thresholds.html", "/settings/thresholds/", settings=_settings(),
|
|
traefik_on=True)
|
|
off = await _render(app, "settings/thresholds.html", "/settings/thresholds/", settings=_settings(),
|
|
traefik_on=False)
|
|
assert 'id="traefik"' in on and 'name="error_5xx_pct"' in on and 'value="0.1"' in on
|
|
assert 'id="traefik"' not in off
|
|
assert "Ping widget" not in on and "Response time" in on
|
|
|
|
|
|
async def test_settings_tabs_sit_above_the_trail(app):
|
|
page = await _render(app, "settings/thresholds.html", "/settings/thresholds/", settings=_settings(),
|
|
traefik_on=False)
|
|
tabs, trail = page.index('aria-label="Settings"'), page.index('aria-label="Breadcrumb"')
|
|
assert tabs < trail
|
|
assert '<a href="/settings/thresholds/" aria-current="page">' in page
|