Changeset View
Changeset View
Standalone View
Standalone View
swh/web/tests/api/views/__init__.py
Show All 21 Lines | ) -> Response: | ||||
Returns: | Returns: | ||||
The Web API JSON response | The Web API JSON response | ||||
""" | """ | ||||
# check API Web UI | # check API Web UI | ||||
html_content_type = "text/html" | html_content_type = "text/html" | ||||
resp = api_client.get(url, HTTP_ACCEPT=html_content_type) | resp = api_client.get(url, HTTP_ACCEPT=html_content_type) | ||||
assert resp.status_code == status_code, resp.content | assert resp.status_code == status_code, resp.content | ||||
assert resp["Content-Type"] == html_content_type | assert resp["Content-Type"].startswith(html_content_type) | ||||
# check YAML response | # check YAML response | ||||
yaml_content_type = "application/yaml" | yaml_content_type = "application/yaml" | ||||
resp = api_client.get(url, HTTP_ACCEPT=yaml_content_type) | resp = api_client.get(url, HTTP_ACCEPT=yaml_content_type) | ||||
assert resp.status_code == status_code, resp.data | assert resp.status_code == status_code, resp.data | ||||
assert resp["Content-Type"] == yaml_content_type | assert resp["Content-Type"] == yaml_content_type | ||||
# check JSON response | # check JSON response | ||||
Show All 33 Lines |