aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAljoscha Rittner <[email protected]>2022-06-16 14:52:15 +0200
committerAljoscha Rittner <[email protected]>2022-06-16 14:52:15 +0200
commit19dbb4594ec4fe47c3e9704c8b9365e3834764c2 (patch)
tree71de0276b71990eb45e15bca46eacf32ba97e403 /tests
parente9d2c3d53f7b1d371e5dc5bf47e5fe335b698c85 (diff)
downloadmastodon.py-19dbb4594ec4fe47c3e9704c8b9365e3834764c2.tar.gz
Changes the storage for pagination information
fixes #232
Diffstat (limited to 'tests')
-rw-r--r--tests/cassettes/test_domain_blocks.yaml7
-rw-r--r--tests/test_pagination.py12
2 files changed, 11 insertions, 8 deletions
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:
10 method: GET 10 method: GET
11 uri: http://localhost:3000/api/v1/domain_blocks 11 uri: http://localhost:3000/api/v1/domain_blocks
12 response: 12 response:
13 body: {string: '[]'} 13 body: {string: '["example.com"]'}
14 headers: 14 headers:
15 Cache-Control: ['no-cache, no-store'] 15 Cache-Control: ['no-cache, no-store']
16 Content-Type: [application/json; charset=utf-8] 16 Content-Type: [application/json; charset=utf-8]
17 Link: ['<http://localhost:3000/api/v1/domain_blocks?max_id=10023>;
18 rel="next", <http://localhost:3000/api/v1/domain_blocks?min_id=10021>;
19 rel="prev"']
17 Referrer-Policy: [strict-origin-when-cross-origin] 20 Referrer-Policy: [strict-origin-when-cross-origin]
18 Transfer-Encoding: [chunked] 21 Transfer-Encoding: [chunked]
19 Vary: ['Accept-Encoding, Origin'] 22 Vary: ['Accept-Encoding, Origin']
@@ -24,6 +27,6 @@ interactions:
24 X-Request-Id: [79ec8c37-a374-47e4-a698-a8b8511ca20f] 27 X-Request-Id: [79ec8c37-a374-47e4-a698-a8b8511ca20f]
25 X-Runtime: ['0.098492'] 28 X-Runtime: ['0.098492']
26 X-XSS-Protection: [1; mode=block] 29 X-XSS-Protection: [1; mode=block]
27 content-length: ['2'] 30 content-length: ['15']
28 status: {code: 200, message: OK} 31 status: {code: 200, message: OK}
29version: 1 32version: 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):
39 account = api.account_verify_credentials() 39 account = api.account_verify_credentials()
40 with many_statuses(api): 40 with many_statuses(api):
41 statuses = api.account_statuses(account['id'], limit=5) 41 statuses = api.account_statuses(account['id'], limit=5)
42 next_statuses = api.fetch_next(statuses[-1]._pagination_next) 42 next_statuses = api.fetch_next(statuses._pagination_next)
43 assert next_statuses 43 assert next_statuses
44 previous_statuses = api.fetch_previous(next_statuses[0]._pagination_prev) 44 previous_statuses = api.fetch_previous(next_statuses._pagination_prev)
45 assert previous_statuses 45 assert previous_statuses
46 46
47def test_fetch_next_previous_old_pagination(api): 47def test_fetch_next_previous_old_pagination(api):
@@ -61,9 +61,9 @@ def test_fetch_next_previous_from_pagination_info_old_pagination(api):
61 61
62 with many_statuses(api): 62 with many_statuses(api):
63 statuses = api.account_statuses(account['id'], limit=5) 63 statuses = api.account_statuses(account['id'], limit=5)
64 next_statuses = api.fetch_next(statuses[-1]._pagination_next) 64 next_statuses = api.fetch_next(statuses._pagination_next)
65 assert next_statuses 65 assert next_statuses
66 previous_statuses = api.fetch_previous(next_statuses[0]._pagination_prev) 66 previous_statuses = api.fetch_previous(next_statuses._pagination_prev)
67 assert previous_statuses 67 assert previous_statuses
68 68
69@pytest.mark.vcr() 69@pytest.mark.vcr()
@@ -86,5 +86,5 @@ def test_link_headers(api):
86 }) 86 })
87 87
88 resp = api.timeline_hashtag(UNLIKELY_HASHTAG) 88 resp = api.timeline_hashtag(UNLIKELY_HASHTAG)
89 assert resp[0]._pagination_next['max_id'] == _id 89 assert resp._pagination_next['max_id'] == _id
90 assert resp[0]._pagination_prev['since_id'] == _id 90 assert resp._pagination_prev['since_id'] == _id
Powered by cgit v1.2.3 (git 2.41.0)