add test for fetch_remaining

This commit is contained in:
codl 2017-11-28 01:49:15 +01:00
pare 655a45e086
commit d47f915bfb
No se encontró ninguna clave conocida en la base de datos para esta firma
ID de clave GPG: 6CD7C8891ED1233A
S'han modificat 2 arxius amb 1893 adicions i 2 eliminacions

La diferencia del archivo ha sido suprimido porque es demasiado grande Cargar Diff

Veure arxiu

@ -3,10 +3,10 @@ from contextlib import contextmanager
@contextmanager @contextmanager
def many_statuses(api, n=10): def many_statuses(api, n=10, suffix=''):
statuses = list() statuses = list()
for i in range(n): for i in range(n):
status = api.status_post("Toot number {}!".format(i)) status = api.status_post("Toot number {}!{}".format(i, suffix))
statuses.append(status) statuses.append(status)
yield statuses yield statuses
for status in statuses: for status in statuses:
@ -22,3 +22,13 @@ def test_fetch_next_previous(api):
assert next_statuses assert next_statuses
previous_statuses = api.fetch_previous(next_statuses) previous_statuses = api.fetch_previous(next_statuses)
assert previous_statuses assert previous_statuses
@pytest.mark.vcr()
def test_fetch_remaining(api):
UNLIKELY_HASHTAG = "fgiztsshwiaqqiztpmmjbtvmescsculuvmgjgopwoeidbcrixp"
with many_statuses(api, n=30, suffix=' #'+UNLIKELY_HASHTAG):
hashtag = api.timeline_hashtag(UNLIKELY_HASHTAG, limit=10)
hashtag_remaining = api.fetch_remaining(hashtag)
assert hashtag_remaining
assert len(hashtag_remaining) >= 30