diff options
author | Lorenz Diener <[email protected]> | 2017-11-30 16:02:52 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2017-11-30 16:02:52 +0100 |
commit | 7e3a4a17a28f52b186e6453a0d1f43614f110b4b (patch) | |
tree | 48aafcc35397205d52613cc305dc6baff1cbbda1 /tests/test_pagination.py | |
parent | c6f1196ddc1899e64d60b102e1cfa1c1c1321e77 (diff) | |
parent | d87ada3d73de69ba371acaeca55751e2410c3786 (diff) | |
download | mastodon.py-7e3a4a17a28f52b186e6453a0d1f43614f110b4b.tar.gz |
Merge pull request #113 from codl/more-tests
More tests!
Diffstat (limited to 'tests/test_pagination.py')
-rw-r--r-- | tests/test_pagination.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/test_pagination.py b/tests/test_pagination.py index 5b59143..44fafa1 100644 --- a/tests/test_pagination.py +++ b/tests/test_pagination.py | |||
@@ -1,6 +1,8 @@ | |||
1 | import pytest | 1 | import pytest |
2 | from contextlib import contextmanager | 2 | from contextlib import contextmanager |
3 | 3 | ||
4 | UNLIKELY_HASHTAG = "fgiztsshwiaqqiztpmmjbtvmescsculuvmgjgopwoeidbcrixp" | ||
5 | |||
4 | 6 | ||
5 | @contextmanager | 7 | @contextmanager |
6 | def many_statuses(api, n=10, suffix=''): | 8 | def many_statuses(api, n=10, suffix=''): |
@@ -25,8 +27,18 @@ def test_fetch_next_previous(api): | |||
25 | 27 | ||
26 | 28 | ||
27 | @pytest.mark.vcr() | 29 | @pytest.mark.vcr() |
30 | def test_fetch_next_previous_from_pagination_info(api): | ||
31 | account = api.account_verify_credentials() | ||
32 | with many_statuses(api): | ||
33 | statuses = api.account_statuses(account['id'], limit=5) | ||
34 | next_statuses = api.fetch_next(statuses[-1]['_pagination_next']) | ||
35 | assert next_statuses | ||
36 | previous_statuses = api.fetch_previous(next_statuses[0]['_pagination_prev']) | ||
37 | assert previous_statuses | ||
38 | |||
39 | |||
40 | @pytest.mark.vcr() | ||
28 | def test_fetch_remaining(api): | 41 | def test_fetch_remaining(api): |
29 | UNLIKELY_HASHTAG = "fgiztsshwiaqqiztpmmjbtvmescsculuvmgjgopwoeidbcrixp" | ||
30 | with many_statuses(api, n=30, suffix=' #'+UNLIKELY_HASHTAG): | 42 | with many_statuses(api, n=30, suffix=' #'+UNLIKELY_HASHTAG): |
31 | hashtag = api.timeline_hashtag(UNLIKELY_HASHTAG, limit=10) | 43 | hashtag = api.timeline_hashtag(UNLIKELY_HASHTAG, limit=10) |
32 | hashtag_remaining = api.fetch_remaining(hashtag) | 44 | hashtag_remaining = api.fetch_remaining(hashtag) |