From 1ea86c03302cfc95e5e7d95cd3e6c6df45ddaad5 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Sat, 24 Oct 2026 21:39:14 -0400 Subject: [PATCH] test: a reader's zone comes from their account; a London expiry reads BST or GMT (#6350) The change-form test set the zone on the session, which the auth middleware resets from the account on every request. The password reset test asserted BST, which stopped being London's zone name on 25 Oct. Co-Authored-By: Claude Opus 5.5 --- tests/integration/test_passwords.py | 3 ++- tests/integration/test_timeline_changes.py | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/integration/test_passwords.py b/tests/integration/test_passwords.py index 477c47a..2c8ba57 100644 --- a/tests/integration/test_passwords.py +++ b/tests/integration/test_passwords.py @@ -162,7 +162,8 @@ def test_a_forgotten_password_is_reset_from_the_emailed_link(app, monkeypatch): mine = to(sent, f"{name}@example.com", f"{sso_name}@example.com", f"nobody-{uid[:8]}@example.com") assert [m["To"] for m in mine] == [f"{name}@example.com"] text = mine[0].get_body(("plain",)).get_content() - assert name in text and "BST" in text + # In the account's zone, not UTC: London's name for it, summer or winter. + assert name in text and re.search(r"\d\d:\d\d (BST|GMT)\b", text) key = _KEY.search(text).group(1) page = await (await guest.get(f"/reset/{key}")).get_data(as_text=True) diff --git a/tests/integration/test_timeline_changes.py b/tests/integration/test_timeline_changes.py index 146540d..a8a176d 100644 --- a/tests/integration/test_timeline_changes.py +++ b/tests/integration/test_timeline_changes.py @@ -29,12 +29,13 @@ async def _user(app, name: str, role: str, tz: str | None = None): uid = str(uuid.uuid4()) async with app.db_sessionmaker() as s: async with s.begin(): + # The session takes its zone from the account on every request. s.add(User(id=uid, username=name, email=f"{name}@test", password_hash="x", - role=UserRole(role), is_active=True)) + role=UserRole(role), is_active=True, time_zone=tz)) client = app.test_client() async with client.session_transaction() as sess: sess.update(user_id=uid, user_role=role, username=name, _csrf="test-token", login_at=time.time(), - **({"tz": tz} if tz else {})) + tz=tz) return client, uid