Document and test own_votes

pull/204/head
Lorenz Diener 2019-10-12 19:56:48 +02:00
rodzic fc5e793cde
commit 661e8e0abf
2 zmienionych plików z 4 dodań i 1 usunięć

Wyświetl plik

@ -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.
}

Wyświetl plik

@ -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)