diff options
author | Lorenz Diener <[email protected]> | 2019-10-12 19:56:48 +0200 |
---|---|---|
committer | Lorenz Diener <[email protected]> | 2019-10-12 19:56:48 +0200 |
commit | 661e8e0abfa4d8ebff930d4bcdb7bfc570a922fc (patch) | |
tree | f7159681ae90c0497a3ed8db8fedfd11ae326313 | |
parent | fc5e793cde11b17e457b873cd3fc1b09c293f795 (diff) | |
download | mastodon.py-661e8e0abfa4d8ebff930d4bcdb7bfc570a922fc.tar.gz |
Document and test own_votes
-rw-r--r-- | docs/index.rst | 3 | ||||
-rw-r--r-- | tests/test_polls.py | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/docs/index.rst b/docs/index.rst index 1a9f5f9..6e234d0 100644 --- a/docs/index.rst +++ b/docs/index.rst | |||
@@ -382,7 +382,8 @@ Poll dicts | |||
382 | 'options': # The poll options as a list of dicts, each option with a title and a | 382 | 'options': # The poll options as a list of dicts, each option with a title and a |
383 | # votes_count field. votes_count can be None if the poll creator has | 383 | # votes_count field. votes_count can be None if the poll creator has |
384 | # chosen to hide vote totals until the poll expires and it hasn't yet. | 384 | # chosen to hide vote totals until the poll expires and it hasn't yet. |
385 | 'emojis': # List of emoji dicts for all emoji used in answer strings | 385 | 'emojis': # List of emoji dicts for all emoji used in answer strings, |
386 | 'own_votes': # The logged-in users votes, as a list of indices to the options. | ||
386 | } | 387 | } |
387 | 388 | ||
388 | 389 | ||
diff --git a/tests/test_polls.py b/tests/test_polls.py index ca7335d..2187d31 100644 --- a/tests/test_polls.py +++ b/tests/test_polls.py | |||
@@ -10,10 +10,12 @@ def test_polls(api, api2): | |||
10 | api.poll_vote(status_poll.poll, [1]) | 10 | api.poll_vote(status_poll.poll, [1]) |
11 | poll2 = api.poll(poll) | 11 | poll2 = api.poll(poll) |
12 | assert poll2.votes_count == 1 | 12 | assert poll2.votes_count == 1 |
13 | assert poll2.own_votes == [1] | ||
13 | 14 | ||
14 | api.poll_vote(status_poll.poll, [0]) | 15 | api.poll_vote(status_poll.poll, [0]) |
15 | poll3 = api.poll(poll) | 16 | poll3 = api.poll(poll) |
16 | assert poll3.votes_count == 2 | 17 | assert poll3.votes_count == 2 |
18 | assert poll3.own_votes == [1, 0] | ||
17 | 19 | ||
18 | api2.status_delete(status_poll) | 20 | api2.status_delete(status_poll) |
19 | 21 | ||