diff options
Diffstat (limited to 'tests/test_timeline.py')
-rw-r--r-- | tests/test_timeline.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/test_timeline.py b/tests/test_timeline.py new file mode 100644 index 0000000..d713fca --- /dev/null +++ b/tests/test_timeline.py | |||
@@ -0,0 +1,37 @@ | |||
1 | import pytest | ||
2 | |||
3 | @pytest.mark.vcr() | ||
4 | def test_public_tl_anonymous(api_anonymous, status): | ||
5 | tl = api_anonymous.timeline_public() | ||
6 | assert status['id'] in map(lambda st: st['id'], tl) | ||
7 | # although tempting, we can't do | ||
8 | # assert status in tl | ||
9 | # because the statuses returned in the tl have additional | ||
10 | # pagination-related attributes | ||
11 | |||
12 | @pytest.mark.vcr() | ||
13 | def test_public_tl(api, status): | ||
14 | public = api.timeline_public() | ||
15 | local = api.timeline_local() | ||
16 | assert status['id'] in map(lambda st: st['id'], public) | ||
17 | assert status['id'] in map(lambda st: st['id'], local) | ||
18 | |||
19 | @pytest.mark.vcr() | ||
20 | def test_home_tl(api, status): | ||
21 | tl = api.timeline_home() | ||
22 | assert status['id'] in map(lambda st: st['id'], tl) | ||
23 | |||
24 | @pytest.mark.vcr() | ||
25 | def test_hashtag_tl(api): | ||
26 | status = api.status_post('#hoot (hashtag toot)') | ||
27 | tl = api.timeline_hashtag('hoot') | ||
28 | try: | ||
29 | assert status['id'] in map(lambda st: st['id'], tl) | ||
30 | finally: | ||
31 | api.status_delete(status['id']) | ||
32 | |||
33 | @pytest.mark.vcr() | ||
34 | def test_home_tl_anonymous_throws(api_anonymous): | ||
35 | from mastodon.Mastodon import MastodonAPIError | ||
36 | with pytest.raises(MastodonAPIError): | ||
37 | tl = api_anonymous.timeline_home() | ||