diff options
-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]) | ||