test(monitors): take "12 minutes ago" from the render's own clock (#5121)
CI / lint (push) Successful in 2s
CI / integration (push) Successful in 51s
CI / unit (push) Successful in 1m11s
CI / publish (push) Successful in 1m31s

NOW is fixed when the module is imported; by the time the detail page
rendered in CI seven seconds had passed, and |ago rightly said "12m 7s
ago". The page was right; the test's clock was stale.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-06 17:57:20 -04:00
co-authored by Claude Opus 5.5
parent e595bd922a
commit 629c466fd9
+1 -1
View File
@@ -93,7 +93,7 @@ async def test_the_monitor_page_says_since_when_and_why(app):
session["user_role"] = "admin"
page = await render_template(
"monitors/detail.html", monitor=m, host=None, latest=down, failures=[down], state="down",
since=NOW - timedelta(minutes=12), since_at_least=False, tls_days=None,
since=datetime.now(timezone.utc) - timedelta(minutes=12), since_at_least=False, tls_days=None,
uptime={"24h": 93.0, "7d": None, "30d": 99.5},
heartbeat=[{"state": "up", "title": "a"}, {"state": "down", "title": "b"}])
assert '<a href="/monitors/">Monitors</a>' in page and "shop &lt;api&gt;" in page