diff options
author | codl <[email protected]> | 2017-11-29 23:53:35 +0100 |
---|---|---|
committer | codl <[email protected]> | 2017-11-29 23:59:53 +0100 |
commit | 7464315be7c4a2790c83d1528f8d372ce15f0290 (patch) | |
tree | af91029b252c98b2fbcc991301f3fc7226536add /tests/test_pagination.py | |
parent | 7d51c0b17efe21f552f5d7f47b276810f9aa0280 (diff) | |
download | mastodon.py-7464315be7c4a2790c83d1528f8d372ce15f0290.tar.gz |
add test for using _pagination_prev and _pagination_next directly
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) |