Changeset View
Changeset View
Standalone View
Standalone View
swh/web/client/tests/conftest.py
Show All 14 Lines | for api_call, data in API_DATA.items(): | ||||
headers = {} | headers = {} | ||||
if api_call == "snapshot/cabcc7d7bf639bbe1cc3b41989e1806618dd5764/": | if api_call == "snapshot/cabcc7d7bf639bbe1cc3b41989e1806618dd5764/": | ||||
# monkey patch the only URL that require a special response headers | # monkey patch the only URL that require a special response headers | ||||
# (to make the client init and follow pagination) | # (to make the client init and follow pagination) | ||||
headers = { | headers = { | ||||
"Link": | "Link": | ||||
f"<{API_URL}/{api_call}?branches_count=1000&branches_from=refs/tags/v3.0-rc7>; rel=\"next\"" # NoQA: E501 | f"<{API_URL}/{api_call}?branches_count=1000&branches_from=refs/tags/v3.0-rc7>; rel=\"next\"" # NoQA: E501 | ||||
} | } | ||||
elif api_call == "origin/https://github.com/NixOS/nixpkgs/visits?last_visit=50&per_page=10": # NoQA: E501 | |||||
# monkey patch the only URL that require a special response headers | |||||
zack: this is no longer "the only URL" :-)
can you fix this comment and the one you copied this from… | |||||
# (to make the client init and follow pagination) | |||||
headers = { | |||||
"Link": | |||||
f"<{API_URL}/origin/https://github.com/NixOS/nixpkgs/visits/?last_visit=40&per_page=10>; rel=\"next\"" # NoQA: E501 | |||||
} | |||||
requests_mock.get(f"{API_URL}/{api_call}", text=data, headers=headers) | requests_mock.get(f"{API_URL}/{api_call}", text=data, headers=headers) | ||||
return requests_mock | return requests_mock | ||||
@pytest.fixture | @pytest.fixture | ||||
def web_api_client(): | def web_api_client(): | ||||
# use the fake base API URL that matches API data | # use the fake base API URL that matches API data | ||||
return WebAPIClient(api_url=API_URL) | return WebAPIClient(api_url=API_URL) |
this is no longer "the only URL" :-)
can you fix this comment and the one you copied this from, to simply state why each URL needs monkey patching?