Document and test own_votes

This commit is contained in:
Lorenz Diener 2019-10-12 19:56:48 +02:00
pare fc5e793cde
commit 661e8e0abf
S'han modificat 2 arxius amb 4 adicions i 1 eliminacions

Veure arxiu

@ -382,7 +382,8 @@ Poll dicts
'options': # The poll options as a list of dicts, each option with a title and a
# votes_count field. votes_count can be None if the poll creator has
# chosen to hide vote totals until the poll expires and it hasn't yet.
'emojis': # List of emoji dicts for all emoji used in answer strings
'emojis': # List of emoji dicts for all emoji used in answer strings,
'own_votes': # The logged-in users votes, as a list of indices to the options.
}

Veure arxiu

@ -10,10 +10,12 @@ def test_polls(api, api2):
api.poll_vote(status_poll.poll, [1])
poll2 = api.poll(poll)
assert poll2.votes_count == 1
assert poll2.own_votes == [1]
api.poll_vote(status_poll.poll, [0])
poll3 = api.poll(poll)
assert poll3.votes_count == 2
assert poll3.own_votes == [1, 0]
api2.status_delete(status_poll)