From 450d1375964be79bf22b5eb163b7c28d1cbdd651 Mon Sep 17 00:00:00 2001 From: Lorenz Diener Date: Mon, 29 Apr 2019 17:36:07 +0200 Subject: Oops I forgot to commit the polls test --- tests/test_polls.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tests/test_polls.py 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 @@ +import pytest + +@pytest.mark.vcr() +def test_polls(api, api2): + poll_params = api2.make_poll(["four twenty", "sixty-nine"], 300, multiple=True) + status_poll = api2.status_post("nice", poll=poll_params) + poll = status_poll.poll + assert poll.votes_count == 0 + + api.poll_vote(status_poll.poll, [1]) + poll2 = api.poll(poll) + assert poll2.votes_count == 1 + + api.poll_vote(status_poll.poll, [0]) + poll3 = api.poll(poll) + assert poll3.votes_count == 2 + + api2.status_delete(status_poll) + +@pytest.mark.vcr() +@pytest.mark.xfail(strict=True) +def test_poll_illegal_vote(api, api2): + poll_params = api2.make_poll(["four twenty", "sixty-nine"], 300, multiple=False) + status_poll = api2.status_post("nice", poll=poll_params) + poll = status_poll.poll + api.poll_vote(status_poll.poll, [1]) + api.poll_vote(status_poll.poll, [0]) -- cgit v1.2.3