test(monitors): take "12 minutes ago" from the render's own clock (#5121)
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:
@@ -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 <api>" in page
|
||||
|
||||
Reference in New Issue
Block a user