Changeset View
Changeset View
Standalone View
Standalone View
swh/web/tests/api/views/test_origin.py
Show First 20 Lines • Show All 670 Lines • ▼ Show 20 Lines | url = reverse( | ||||
"api-origin-intrinsic-metadata", url_args={"origin_url": origin["url"]} | "api-origin-intrinsic-metadata", url_args={"origin_url": origin["url"]} | ||||
) | ) | ||||
rv = check_api_get_responses(api_client, url, status_code=200) | rv = check_api_get_responses(api_client, url, status_code=200) | ||||
expected_data = {ORIGIN_METADATA_KEY: ORIGIN_METADATA_VALUE} | expected_data = {ORIGIN_METADATA_KEY: ORIGIN_METADATA_VALUE} | ||||
assert rv.data == expected_data | assert rv.data == expected_data | ||||
@given(origin()) | |||||
def test_api_origin_raw_extrinsic_metadata(api_client, origin): | |||||
url = reverse( | |||||
"api-origin-raw-extrinsic-metadata", url_args={"origin_url": origin["url"]} | |||||
) | |||||
# assert 0 | |||||
rv = check_api_get_responses(api_client, url, status_code=200) | |||||
expected_data = {ORIGIN_METADATA_KEY: ORIGIN_METADATA_VALUE} | |||||
assert rv.data == expected_data | |||||
def test_api_origin_metadata_search_invalid(api_client, mocker): | def test_api_origin_metadata_search_invalid(api_client, mocker): | ||||
mock_idx_storage = mocker.patch("swh.web.common.archive.idx_storage") | mock_idx_storage = mocker.patch("swh.web.common.archive.idx_storage") | ||||
url = reverse("api-1-origin-metadata-search") | url = reverse("api-1-origin-metadata-search") | ||||
check_api_get_responses(api_client, url, status_code=400) | check_api_get_responses(api_client, url, status_code=400) | ||||
mock_idx_storage.assert_not_called() | mock_idx_storage.assert_not_called() |