Camera app scan: the first scan only opens the page, joining takes the ring or a second scan read within 4 s of the qr leaving the screen (votes keep 12 s); organizers can turn it off; open vote options and turnout bar stay above the big qr; native scan noted under the check
This commit is contained in:
@@ -790,6 +790,10 @@ def test_camera_app_scan_enrolls_and_covers_votes(server):
|
||||
con.close()
|
||||
stale = tk.make_pass(secret, p["id"], e["slot"] - 6)
|
||||
assert (await b.post(f"/api/v/{p['id']}/pass", json={"token": stale})).json()["status"] == "expired"
|
||||
# gone from the screen 6 s ago: too late to join (4 s), still fine for a vote (12 s)
|
||||
recent = tk.make_pass(secret, p["id"], tk.current_slot(3000) - 3)
|
||||
assert (await b.post(f"/api/v/{p['id']}/pass", json={"token": recent})).json()["status"] == "late"
|
||||
assert (await a.post(f"/api/v/{p['id']}/pass", json={"token": recent})).json()["status"] == "pass"
|
||||
# late arrival after enrollment closed: nothing to do here
|
||||
admin(server, p, "PATCH", "", json={"enrollment_open": False})
|
||||
e = await camera_code(server, p)
|
||||
@@ -828,3 +832,23 @@ def test_classic_qr_is_the_camera_code(server):
|
||||
await a.aclose()
|
||||
|
||||
asyncio.run(run())
|
||||
|
||||
|
||||
def test_camera_app_scan_can_be_turned_off(server):
|
||||
p = create(server, camera_pass=False)
|
||||
admin(server, p, "PATCH", "", json={"enrollment_open": True})
|
||||
assert admin(server, p, "GET", "").json()["poll"]["camera_pass"] is False
|
||||
|
||||
async def run():
|
||||
e = await camera_code(server, p)
|
||||
assert "token" not in e and len(e["modules"]) == 29
|
||||
a = device(server)
|
||||
r = await a.get(f"/V/{p['id']}/1-AAAAAAAAAA", follow_redirects=False)
|
||||
assert r.headers["location"] == f"/v/{p['id']}"
|
||||
assert (await a.post(f"/api/v/{p['id']}/pass", json={"token": "1-AAAAAAAAAA"})).json()["status"] == "off"
|
||||
admin(server, p, "PATCH", "", json={"camera_pass": True})
|
||||
e = await camera_code(server, p)
|
||||
assert (await a.post(f"/api/v/{p['id']}/pass", json={"token": e["token"]})).json()["status"] == "enrolled"
|
||||
await a.aclose()
|
||||
|
||||
asyncio.run(run())
|
||||
|
||||
Reference in New Issue
Block a user