diff options
author | Lorenz Diener <[email protected]> | 2019-04-29 17:36:07 +0200 |
---|---|---|
committer | Lorenz Diener <[email protected]> | 2019-04-29 17:36:07 +0200 |
commit | 450d1375964be79bf22b5eb163b7c28d1cbdd651 (patch) | |
tree | f39426e754fe8cc954748f52126bebd2d23fa833 | |
parent | 295903375cb9b30a45332ea0afc16c5897b17e84 (diff) | |
download | mastodon.py-450d1375964be79bf22b5eb163b7c28d1cbdd651.tar.gz |
Oops I forgot to commit the polls test
-rw-r--r-- | tests/test_polls.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/test_polls.py b/tests/test_polls.py new file mode 100644 index 0000000..ca7335d --- /dev/null +++ b/tests/test_polls.py | |||
@@ -0,0 +1,27 @@ | |||
1 | import pytest | ||
2 | |||
3 | @pytest.mark.vcr() | ||
4 | def test_polls(api, api2): | ||
5 | poll_params = api2.make_poll(["four twenty", "sixty-nine"], 300, multiple=True) | ||
6 | status_poll = api2.status_post("nice", poll=poll_params) | ||
7 | poll = status_poll.poll | ||
8 | assert poll.votes_count == 0 | ||
9 | |||
10 | api.poll_vote(status_poll.poll, [1]) | ||
11 | poll2 = api.poll(poll) | ||
12 | assert poll2.votes_count == 1 | ||
13 | |||
14 | api.poll_vote(status_poll.poll, [0]) | ||
15 | poll3 = api.poll(poll) | ||
16 | assert poll3.votes_count == 2 | ||
17 | |||
18 | api2.status_delete(status_poll) | ||
19 | |||
20 | @pytest.mark.vcr() | ||
21 | @pytest.mark.xfail(strict=True) | ||
22 | def test_poll_illegal_vote(api, api2): | ||
23 | poll_params = api2.make_poll(["four twenty", "sixty-nine"], 300, multiple=False) | ||
24 | status_poll = api2.status_post("nice", poll=poll_params) | ||
25 | poll = status_poll.poll | ||
26 | api.poll_vote(status_poll.poll, [1]) | ||
27 | api.poll_vote(status_poll.poll, [0]) | ||