diff --git a/swh/web/common/archive.py b/swh/web/common/archive.py --- a/swh/web/common/archive.py +++ b/swh/web/common/archive.py @@ -1338,9 +1338,9 @@ elif obj_type == REVISION: missing_hashes.append(storage.revision_missing(obj_ids)) elif obj_type == RELEASE: - missing_hashes.append(storage.directory_missing(obj_ids)) + missing_hashes.append(storage.release_missing(obj_ids)) elif obj_type == SNAPSHOT: - missing_hashes.append(storage.directory_missing(obj_ids)) + missing_hashes.append(storage.snapshot_missing(obj_ids)) missing = set( map(lambda x: hashutil.hash_to_hex(x), itertools.chain(*missing_hashes)) diff --git a/swh/web/tests/api/views/test_identifiers.py b/swh/web/tests/api/views/test_identifiers.py --- a/swh/web/tests/api/views/test_identifiers.py +++ b/swh/web/tests/api/views/test_identifiers.py @@ -113,6 +113,25 @@ check_api_get_responses(api_client, url, status_code=400) +@given(content(), directory(), release(), revision(), snapshot()) +def test_api_known_swhid_all_present( + api_client, content, directory, release, revision, snapshot +): + input_swhids = [ + gen_swhid(CONTENT, content["sha1_git"]), + gen_swhid(DIRECTORY, directory), + gen_swhid(REVISION, revision), + gen_swhid(RELEASE, release), + gen_swhid(SNAPSHOT, snapshot), + ] + + url = reverse("api-1-known") + + resp = check_api_post_responses(api_client, url, data=input_swhids, status_code=200) + + assert resp.data == {swhid: {"known": True} for swhid in input_swhids} + + @given(content(), directory()) def test_api_known_swhid_some_present(api_client, content, directory): content_ = gen_swhid(CONTENT, content["sha1_git"])