Files
FabledSteward/tests/core/test_status_page.py
T
bvandeusenandClaude Opus 5.5 434127b3e1
CI / lint (push) Successful in 4s
CI / integration (push) Successful in 1m10s
CI / unit (push) Successful in 1m36s
CI / publish (push) Successful in 1m28s
feat(monitors): Monitors absorbs the Status page; Status is removed (#5270)
Status repeated the Monitors page's counts, check strip and uptime. Monitors
now has one header row and every column Status had: the last 30 checks,
latest response with its trend, uptime over 24h / 7d / 30d (the range picker
goes) and TLS days on every row. /status and /status/rows and the nav link
are removed outright; the dashboard Overview (/status/widget) stays and its
Details link goes to Monitors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 15:36:38 -04:00

27 lines
933 B
Python

"""How long a monitor has been in its state (#5120). The Status page that
first showed it was folded into Monitors (#5270)."""
from datetime import datetime, timedelta, timezone
from types import SimpleNamespace
import pytest
from steward.core.status import streak_start
T0 = datetime(2026, 10, 6, 18, 0, tzinfo=timezone.utc)
def _checks(*ups):
return [SimpleNamespace(is_up=up, checked_at=T0 + timedelta(minutes=i)) for i, up in enumerate(ups)]
@pytest.mark.parametrize("ups, since, at_least", [
((), None, False),
((True,), 0, True),
((False, False, False), 0, True), # down for every check we have
((True, True, False, False), 2, False), # went down at the third check
((False, True, True, False), 3, False),
])
def test_streak_start(ups, since, at_least):
checks = _checks(*ups)
assert streak_start(checks) == ((checks[since].checked_at if since is not None else None), at_least)