Changeset View
Changeset View
Standalone View
Standalone View
swh/web/tests/common/test_archive.py
Show First 20 Lines • Show All 210 Lines • ▼ Show 20 Lines | |||||
def test_lookup_origin(archive_data, new_origin): | def test_lookup_origin(archive_data, new_origin): | ||||
archive_data.origin_add([new_origin]) | archive_data.origin_add([new_origin]) | ||||
actual_origin = archive.lookup_origin({"url": new_origin.url}) | actual_origin = archive.lookup_origin({"url": new_origin.url}) | ||||
expected_origin = archive_data.origin_get([new_origin.url])[0] | expected_origin = archive_data.origin_get([new_origin.url])[0] | ||||
assert actual_origin == expected_origin | assert actual_origin == expected_origin | ||||
def test_lookup_origin_snapshots(archive_data, origin_with_multiple_visits): | |||||
origin_url = origin_with_multiple_visits["url"] | |||||
visits = archive_data.origin_visit_get(origin_url) | |||||
origin_snapshots = archive.lookup_origin_snapshots(origin_with_multiple_visits) | |||||
assert set(origin_snapshots) == {v["snapshot"] for v in visits} | |||||
def test_lookup_release_ko_id_checksum_not_a_sha1(invalid_sha1): | def test_lookup_release_ko_id_checksum_not_a_sha1(invalid_sha1): | ||||
with pytest.raises(BadInputExc) as e: | with pytest.raises(BadInputExc) as e: | ||||
archive.lookup_release(invalid_sha1) | archive.lookup_release(invalid_sha1) | ||||
assert e.match("Invalid checksum") | assert e.match("Invalid checksum") | ||||
def test_lookup_release_ko_id_checksum_too_long(sha256): | def test_lookup_release_ko_id_checksum_too_long(sha256): | ||||
with pytest.raises(BadInputExc) as e: | with pytest.raises(BadInputExc) as e: | ||||
▲ Show 20 Lines • Show All 918 Lines • Show Last 20 Lines |