Vote presence: codes may span the enrollment slack as long as one is fresh (slow phones hit 'scan expiré' with 5 scans); phone drops codes too old to count

This commit is contained in:
2026-11-17 14:14:56 +01:00
parent d761d8b510
commit 0697c27a01
3 changed files with 16 additions and 6 deletions
+4 -3
View File
@@ -518,9 +518,10 @@ def test_vote_needs_fresh_presence_scans(server):
await asyncio.sleep(3.5) # photo of the screen taken earlier
r = await a.post(url, json={"question_id": qid, "choices": [0], "presence": old})
assert r.json()["error"] == "presence_required"
fresh = [await next_token() for _ in range(3)]
r = await a.post(url, json={"question_id": qid, "choices": [1], "presence": fresh})
assert r.status_code == 200
# slow phone: two codes read a while ago and one just now, all distinct, counts
mixed = old[1:] + [await next_token()]
r = await a.post(url, json={"question_id": qid, "choices": [1], "presence": mixed})
assert r.status_code == 200, r.text
await a.aclose()
asyncio.run(run())