test(invites): match the escaped apostrophe; give test admins a real address
CI / lint (push) Successful in 6s
CI / unit (push) Successful in 1m43s
CI / integration (push) Successful in 1m17s
CI / publish (push) Successful in 1m41s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 17:00:13 -04:00
co-authored by Claude Opus 5.5
parent 2b6e12859a
commit fb4cf098c3
+3 -3
View File
@@ -36,7 +36,7 @@ async def _admin(app, role="admin"):
name = f"inv-{uid[:8]}"
async with app.db_sessionmaker() as s:
async with s.begin():
s.add(User(id=uid, username=name, email=f"{uid}@test", password_hash="x",
s.add(User(id=uid, username=name, email=f"{uid[:8]}-{name}@example.com", password_hash="x",
role=UserRole(role), is_active=True, time_zone="America/New_York"))
client = app.test_client()
async with client.session_transaction() as sess:
@@ -104,7 +104,7 @@ def test_an_invite_is_emailed_and_the_invitee_makes_their_own_account_once(app,
mine = f"me-{aid[:8]}@example.com"
form = {"username": f"joined-{aid[:8]}", "email": mine, "password": "longenough", "confirm": "nope"}
resp = await guest.post(f"/invite/{key}", headers=CSRF, form=form)
assert resp.status_code == 400 and "don't match" in await resp.get_data(as_text=True)
assert resp.status_code == 400 and "passwords don" in await resp.get_data(as_text=True)
resp = await guest.post(f"/invite/{key}", headers=CSRF, form=form | {"username": aname, "confirm": "longenough"})
assert resp.status_code == 400 and f"username {aname} is taken" in await resp.get_data(as_text=True)
@@ -182,7 +182,7 @@ def test_an_address_with_an_account_is_not_invited_and_only_an_admin_invites(app
async def _go():
admin, aid, _ = await _admin(app)
resp = await admin.post("/settings/users/invite", headers=CSRF,
form={"email": f"{aid}@test", "role": "viewer", "days": "7"})
form={"email": f"{aid[:8]}-inv-{aid[:8]}@example.com", "role": "viewer", "days": "7"})
assert resp.status_code == 400 and "already has an account" in await resp.get_data(as_text=True)
resp = await admin.post("/settings/users/invite", headers=CSRF,
form={"email": "x@example.com", "role": "viewer", "days": "3"})