diff options
author | codl <[email protected]> | 2017-11-28 01:49:15 +0100 |
---|---|---|
committer | codl <[email protected]> | 2017-11-28 01:49:15 +0100 |
commit | d47f915bfb81b5be1d980bf0258bbdd7fe75e16d (patch) | |
tree | 070d5e5958879936c6db56618853638f5dbd49ea /tests/test_pagination.py | |
parent | 655a45e086f8c2e05be14dc55aa1fe366ffbb171 (diff) | |
download | mastodon.py-d47f915bfb81b5be1d980bf0258bbdd7fe75e16d.tar.gz |
add test for fetch_remaining
Diffstat (limited to 'tests/test_pagination.py')
-rw-r--r-- | tests/test_pagination.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/test_pagination.py b/tests/test_pagination.py index 30bdf89..5b59143 100644 --- a/tests/test_pagination.py +++ b/tests/test_pagination.py | |||
@@ -3,10 +3,10 @@ from contextlib import contextmanager | |||
3 | 3 | ||
4 | 4 | ||
5 | @contextmanager | 5 | @contextmanager |
6 | def many_statuses(api, n=10): | 6 | def many_statuses(api, n=10, suffix=''): |
7 | statuses = list() | 7 | statuses = list() |
8 | for i in range(n): | 8 | for i in range(n): |
9 | status = api.status_post("Toot number {}!".format(i)) | 9 | status = api.status_post("Toot number {}!{}".format(i, suffix)) |
10 | statuses.append(status) | 10 | statuses.append(status) |
11 | yield statuses | 11 | yield statuses |
12 | for status in statuses: | 12 | for status in statuses: |
@@ -22,3 +22,13 @@ def test_fetch_next_previous(api): | |||
22 | assert next_statuses | 22 | assert next_statuses |
23 | previous_statuses = api.fetch_previous(next_statuses) | 23 | previous_statuses = api.fetch_previous(next_statuses) |
24 | assert previous_statuses | 24 | assert previous_statuses |
25 | |||
26 | |||
27 | @pytest.mark.vcr() | ||
28 | def test_fetch_remaining(api): | ||
29 | UNLIKELY_HASHTAG = "fgiztsshwiaqqiztpmmjbtvmescsculuvmgjgopwoeidbcrixp" | ||
30 | with many_statuses(api, n=30, suffix=' #'+UNLIKELY_HASHTAG): | ||
31 | hashtag = api.timeline_hashtag(UNLIKELY_HASHTAG, limit=10) | ||
32 | hashtag_remaining = api.fetch_remaining(hashtag) | ||
33 | assert hashtag_remaining | ||
34 | assert len(hashtag_remaining) >= 30 | ||