test(settings): the adopt-zone test gives the account its zone — the session copy is refreshed from it
CI / lint (push) Successful in 4s
CI / integration (push) Successful in 1m38s
CI / unit (push) Successful in 1m52s
CI / publish (push) Successful in 1m12s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 15:39:47 -04:00
co-authored by Claude Opus 5.5
parent 7ae6f85032
commit 31e32c173c
+3 -5
View File
@@ -26,13 +26,13 @@ def app():
return create_app(testing=False)
async def _client(app, role="admin"):
async def _client(app, role="admin", tz=None):
from steward.models.users import User, UserRole
uid = str(uuid.uuid4())
async with app.db_sessionmaker() as s:
async with s.begin():
s.add(User(id=uid, username=f"adm-{uid[:8]}", email=f"{uid}@test",
password_hash="x", role=UserRole(role), is_active=True))
password_hash="x", 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=f"adm-{uid[:8]}",
@@ -212,9 +212,7 @@ def test_the_first_admin_to_open_notifications_sets_the_also_send_to_zone(app):
async with s.begin():
await set_setting(s, "smtp.tz", "")
for zone in ("America/Chicago", "Asia/Tokyo"):
admin, _ = await _client(app)
async with admin.session_transaction() as sess:
sess["tz"] = zone
admin, _ = await _client(app, tz=zone) # each request reads the zone from the account
assert (await admin.get("/settings/notifications/")).status_code == 200
assert await _tz() == "America/Chicago" # the second admin's zone changes nothing