feat(tui): clarify monitoring continuity and quitting
This commit is contained in:
@@ -399,6 +399,89 @@ class TestCI2Parity:
|
||||
assert "last collect:" in status
|
||||
assert "freshness:" in status
|
||||
|
||||
def test_dashboard_clarity_parity_strings_have_one_status_source(self):
|
||||
"""DC-2/DC-3 wording originates in status and the TUI imports it."""
|
||||
status_src = (FENRIS_PKG / "status.py").read_text()
|
||||
tui_src = (FENRIS_PKG / "tui.py").read_text()
|
||||
for wording in (
|
||||
"monitoring: active in background · persists across reboots",
|
||||
"monitoring: does not start on next boot",
|
||||
"monitoring: paused — deliberate disable",
|
||||
"paused time is excluded from your usage habit · resume: fenris monitor resume",
|
||||
):
|
||||
assert status_src.count(wording) == 1
|
||||
assert wording not in tui_src
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.parametrize(
|
||||
("state", "service", "expected_lines"),
|
||||
[
|
||||
(
|
||||
"active_enabled",
|
||||
{"boot_enabled": True, "timer_active": True},
|
||||
["monitoring: active in background · persists across reboots"],
|
||||
),
|
||||
(
|
||||
"boot_disabled",
|
||||
{"boot_enabled": False, "timer_active": False},
|
||||
["monitoring: does not start on next boot"],
|
||||
),
|
||||
(
|
||||
"deliberately_paused",
|
||||
{"boot_enabled": False, "timer_active": False},
|
||||
[
|
||||
"monitoring: does not start on next boot",
|
||||
"monitoring: paused — deliberate disable",
|
||||
"paused time is excluded from your usage habit · resume: fenris monitor resume",
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
async def test_dashboard_clarity_monitoring_lines_match_both_views(
|
||||
self, tmp_path, state, service, expected_lines
|
||||
):
|
||||
"""CI-2 synthetic-store sweep covers active, disabled, and paused states."""
|
||||
db = tmp_path / (state + ".db")
|
||||
conn = init_store(db)
|
||||
if state == "active_enabled":
|
||||
ensure_period_open(conn, _clock())
|
||||
elif state == "deliberately_paused":
|
||||
conn.execute(
|
||||
"INSERT INTO monitoring_periods (started_at, ended_at, end_cause) "
|
||||
"VALUES (?, ?, ?)",
|
||||
("2026-09-30T09:00:00+00:00", "2026-09-30T10:00:00+00:00", "user_disabled"),
|
||||
)
|
||||
conn.commit()
|
||||
conn.close()
|
||||
service_state = {
|
||||
**service,
|
||||
"last_collect_ok": None,
|
||||
"last_collect_age_s": None,
|
||||
"last_collect_reason": None,
|
||||
}
|
||||
|
||||
with patch("fenris.status.query_service_state", return_value=service_state), patch(
|
||||
"fenris.tui.query_service_state", return_value=service_state
|
||||
):
|
||||
status = get_status(
|
||||
store_path=db, clock_now=_clock(), query_services=True, query_journal=False
|
||||
).lower()
|
||||
app = FenrisTuiApp(store_path=db)
|
||||
async with app.run_test(size=(100, 40)):
|
||||
tui_text = "\n".join(
|
||||
(
|
||||
str(app.query_one("#service-strip").render()),
|
||||
str(app.query_one("#paused-banner").render()),
|
||||
)
|
||||
).lower()
|
||||
|
||||
for expected in expected_lines:
|
||||
assert expected in status
|
||||
assert expected in tui_text
|
||||
if state != "deliberately_paused":
|
||||
assert "monitoring: paused — deliberate disable" not in status
|
||||
assert "monitoring: paused — deliberate disable" not in tui_text
|
||||
|
||||
def test_pause_resume_action_names(self):
|
||||
tui_keys = {b.key for b in FenrisTuiApp.BINDINGS}
|
||||
assert "p" in tui_keys
|
||||
|
||||
Reference in New Issue
Block a user