From 19dbb4594ec4fe47c3e9704c8b9365e3834764c2 Mon Sep 17 00:00:00 2001 From: Aljoscha Rittner Date: Thu, 16 Jun 2022 14:52:15 +0200 Subject: Changes the storage for pagination information fixes #232 --- tests/cassettes/test_domain_blocks.yaml | 7 +++++-- tests/test_pagination.py | 12 ++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'tests') diff --git a/tests/cassettes/test_domain_blocks.yaml b/tests/cassettes/test_domain_blocks.yaml index 8889bb1..041541e 100644 --- a/tests/cassettes/test_domain_blocks.yaml +++ b/tests/cassettes/test_domain_blocks.yaml @@ -10,10 +10,13 @@ interactions: method: GET uri: http://localhost:3000/api/v1/domain_blocks response: - body: {string: '[]'} + body: {string: '["example.com"]'} headers: Cache-Control: ['no-cache, no-store'] Content-Type: [application/json; charset=utf-8] + Link: ['; + rel="next", ; + rel="prev"'] Referrer-Policy: [strict-origin-when-cross-origin] Transfer-Encoding: [chunked] Vary: ['Accept-Encoding, Origin'] @@ -24,6 +27,6 @@ interactions: X-Request-Id: [79ec8c37-a374-47e4-a698-a8b8511ca20f] X-Runtime: ['0.098492'] X-XSS-Protection: [1; mode=block] - content-length: ['2'] + content-length: ['15'] status: {code: 200, message: OK} version: 1 diff --git a/tests/test_pagination.py b/tests/test_pagination.py index 72ac06e..8a85ccb 100644 --- a/tests/test_pagination.py +++ b/tests/test_pagination.py @@ -39,9 +39,9 @@ def test_fetch_next_previous_from_pagination_info(api): account = api.account_verify_credentials() with many_statuses(api): statuses = api.account_statuses(account['id'], limit=5) - next_statuses = api.fetch_next(statuses[-1]._pagination_next) + next_statuses = api.fetch_next(statuses._pagination_next) assert next_statuses - previous_statuses = api.fetch_previous(next_statuses[0]._pagination_prev) + previous_statuses = api.fetch_previous(next_statuses._pagination_prev) assert previous_statuses def test_fetch_next_previous_old_pagination(api): @@ -61,9 +61,9 @@ def test_fetch_next_previous_from_pagination_info_old_pagination(api): with many_statuses(api): statuses = api.account_statuses(account['id'], limit=5) - next_statuses = api.fetch_next(statuses[-1]._pagination_next) + next_statuses = api.fetch_next(statuses._pagination_next) assert next_statuses - previous_statuses = api.fetch_previous(next_statuses[0]._pagination_prev) + previous_statuses = api.fetch_previous(next_statuses._pagination_prev) assert previous_statuses @pytest.mark.vcr() @@ -86,5 +86,5 @@ def test_link_headers(api): }) resp = api.timeline_hashtag(UNLIKELY_HASHTAG) - assert resp[0]._pagination_next['max_id'] == _id - assert resp[0]._pagination_prev['since_id'] == _id + assert resp._pagination_next['max_id'] == _id + assert resp._pagination_prev['since_id'] == _id -- cgit v1.2.3