From cfc9c1ce0c6440506d3a88397c65ad47bdd2d662 Mon Sep 17 00:00:00 2001 From: codl Date: Mon, 27 Nov 2017 14:19:21 +0100 Subject: add timeline tests --- tests/test_timeline.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/test_timeline.py (limited to 'tests/test_timeline.py') diff --git a/tests/test_timeline.py b/tests/test_timeline.py new file mode 100644 index 0000000..0306391 --- /dev/null +++ b/tests/test_timeline.py @@ -0,0 +1,30 @@ +import pytest + +@pytest.mark.vcr() +def test_public_tl_anonymous(mastodon_anonymous, status): + tl = mastodon_anonymous.timeline_public() + assert status['id'] in map(lambda st: st['id'], tl) + # although tempting, we can't do + # assert status in tl + # because the statuses returned in the tl have additional + # pagination-related attributes + +@pytest.mark.vcr() +def test_public_tl(mastodon, status): + tl = mastodon.timeline_public() + print(tl[0]) + assert status['id'] in map(lambda st: st['id'], tl) + +@pytest.mark.vcr() +def test_home_tl(mastodon, status): + tl = mastodon.timeline_home() + assert status['id'] in map(lambda st: st['id'], tl) + +@pytest.mark.vcr() +def test_hashtag_tl(mastodon): + status = mastodon.status_post('#hoot (hashtag toot)') + tl = mastodon.timeline_hashtag('hoot') + try: + assert status['id'] in map(lambda st: st['id'], tl) + finally: + mastodon.status_delete(status['id']) -- cgit v1.2.3