Last active
November 28, 2018 17:28
-
-
Save jaraco/13038365bfc1f17c65b2b27dc0bf87a8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__requires__ = ['pytest-responses', 'pytest'] | |
import requests | |
def test_paginated_request(responses): | |
responses.add( | |
responses.GET, | |
'https://service.test/api/paginated/', | |
json=dict( | |
objects=[1, 2, 3], | |
meta=dict(next='/api/paginated/?start=4'), | |
), | |
) | |
responses.add( | |
responses.GET, | |
'https://service.test/api/paginated/?start=4', | |
json=dict( | |
objects=[4, 5, 6], | |
), | |
) | |
requests.get('https://service.test/api/paginated/') | |
doc = requests.get('https://service.test/api/paginated/?start=4').json() | |
assert doc['objects'] == [4, 5, 6] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment