aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Diener <[email protected]>2017-11-29 17:48:56 +0100
committerGitHub <[email protected]>2017-11-29 17:48:56 +0100
commit961425e2abc91d693004f2c0d073e387de64e58c (patch)
tree8b1512daf97ab63b54f4edebc83b35f524571c53 /tests/test_timeline.py
parent5b811b719d379be06ed256da2ee806a051461795 (diff)
parente79987df2410ee32302abed9e486a72b2dfc9707 (diff)
downloadmastodon.py-961425e2abc91d693004f2c0d073e387de64e58c.tar.gz
Merge pull request #109 from codl/test-suite
Test suite
Diffstat (limited to 'tests/test_timeline.py')
-rw-r--r--tests/test_timeline.py37
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 @@
1import pytest
2
3@pytest.mark.vcr()
4def 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()
13def 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()
20def 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()
25def 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()
34def test_home_tl_anonymous_throws(api_anonymous):
35 from mastodon.Mastodon import MastodonAPIError
36 with pytest.raises(MastodonAPIError):
37 tl = api_anonymous.timeline_home()
Powered by cgit v1.2.3 (git 2.41.0)