Clarified vote page message after a vote is cast.
CI / Formatting (push) Successful in 5s
CI / Linting (push) Successful in 5s
CI / Tests (Python 3.12) (push) Successful in 3m0s
CI / Tests (Python 3.13) (push) Successful in 2m58s
CI / Tests (Python 3.14) (push) Successful in 2m55s
CI / Type Checking (push) Successful in 9s
CI / Spelling (push) Successful in 7s

This commit is contained in:
2026-05-11 21:34:11 -04:00
parent cba472e5b4
commit fcedaec099
2 changed files with 20 additions and 1 deletions
@@ -72,7 +72,7 @@
{% elif not has_voted %} {% elif not has_voted %}
<button type="submit" class="btn btn-primary me-2">Vote</button> <button type="submit" class="btn btn-primary me-2">Vote</button>
{% else %} {% else %}
<p class="text-body-secondary mb-0">You have already voted in this poll.</p> <p class="text-body-secondary mb-0">Your vote has been recorded.</p>
{% endif %} {% endif %}
</form> </form>
+19
View File
@@ -1768,6 +1768,25 @@ class TestRoutes:
assert resp.status == 200 assert resp.status == 200
assert expected in await resp.text() assert expected in await resp.text()
async def test_current_page_confirms_recorded_vote(
self,
module_context: ModuleContext,
route_client: TestClient[Any, Any],
session_manager: SessionManager,
) -> None:
"""GET /current confirms an already-recorded vote."""
manager = get_manager(module_context)
user = make_user(id="alice", is_authenticated=True)
await _create_poll(manager)
await manager.record_vote(user, {1})
headers = _session_headers(session_manager, user=user)
resp = await route_client.get("/owlbot/polls/current", headers=headers)
assert resp.status == 200
body = await resp.text()
assert "Your vote has been recorded." in body
async def test_vote_submit_records_and_redirects( async def test_vote_submit_records_and_redirects(
self, self,
module_context: ModuleContext, module_context: ModuleContext,