diff options
author | codl <[email protected]> | 2017-11-27 14:19:21 +0100 |
---|---|---|
committer | codl <[email protected]> | 2017-11-27 14:20:31 +0100 |
commit | cfc9c1ce0c6440506d3a88397c65ad47bdd2d662 (patch) | |
tree | 393d35fe5317117f12370fe5c01efa3536c2b717 /tests/test_timeline.py | |
parent | 765db0fc8149aad4c103244e013fdd128af8d3d2 (diff) | |
download | mastodon.py-cfc9c1ce0c6440506d3a88397c65ad47bdd2d662.tar.gz |
add timeline tests
Diffstat (limited to 'tests/test_timeline.py')
-rw-r--r-- | tests/test_timeline.py | 30 |
1 files changed, 30 insertions, 0 deletions
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 @@ | |||
1 | import pytest | ||
2 | |||
3 | @pytest.mark.vcr() | ||
4 | def test_public_tl_anonymous(mastodon_anonymous, status): | ||
5 | tl = mastodon_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(mastodon, status): | ||
14 | tl = mastodon.timeline_public() | ||
15 | print(tl[0]) | ||
16 | assert status['id'] in map(lambda st: st['id'], tl) | ||
17 | |||
18 | @pytest.mark.vcr() | ||
19 | def test_home_tl(mastodon, status): | ||
20 | tl = mastodon.timeline_home() | ||
21 | assert status['id'] in map(lambda st: st['id'], tl) | ||
22 | |||
23 | @pytest.mark.vcr() | ||
24 | def test_hashtag_tl(mastodon): | ||
25 | status = mastodon.status_post('#hoot (hashtag toot)') | ||
26 | tl = mastodon.timeline_hashtag('hoot') | ||
27 | try: | ||
28 | assert status['id'] in map(lambda st: st['id'], tl) | ||
29 | finally: | ||
30 | mastodon.status_delete(status['id']) | ||