Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/package/archive/tests/test_archive.py
Show First 20 Lines • Show All 147 Lines • ▼ Show 20 Lines | assert { | ||||
"origin": 1, | "origin": 1, | ||||
"origin_visit": 1, | "origin_visit": 1, | ||||
"release": 0, | "release": 0, | ||||
"revision": len(_expected_new_revisions_first_visit), | "revision": len(_expected_new_revisions_first_visit), | ||||
"skipped_content": 0, | "skipped_content": 0, | ||||
"snapshot": 1, | "snapshot": 1, | ||||
} == stats | } == stats | ||||
expected_contents = map(hash_to_bytes, _expected_new_contents_first_visit) | |||||
assert list(swh_storage.content_missing_per_sha1(expected_contents)) == [] | |||||
expected_dirs = map(hash_to_bytes, _expected_new_directories_first_visit) | |||||
assert list(swh_storage.directory_missing(expected_dirs)) == [] | |||||
expected_revs = map(hash_to_bytes, _expected_new_revisions_first_visit) | |||||
assert list(swh_storage.revision_missing(expected_revs)) == [] | |||||
expected_snapshot = Snapshot( | expected_snapshot = Snapshot( | ||||
id=expected_snapshot_first_visit_id, | id=expected_snapshot_first_visit_id, | ||||
branches={ | branches={ | ||||
b"HEAD": SnapshotBranch( | b"HEAD": SnapshotBranch( | ||||
target_type=TargetType.ALIAS, target=b"releases/0.1.0", | target_type=TargetType.ALIAS, target=b"releases/0.1.0", | ||||
), | ), | ||||
b"releases/0.1.0": SnapshotBranch( | b"releases/0.1.0": SnapshotBranch( | ||||
target_type=TargetType.REVISION, | target_type=TargetType.REVISION, | ||||
target=hash_to_bytes("44183488c0774ce3c957fa19ba695cf18a4a42b3"), | target=hash_to_bytes(list(_expected_new_revisions_first_visit)[0]), | ||||
), | ), | ||||
}, | }, | ||||
) | ) | ||||
check_snapshot(expected_snapshot, swh_storage) | check_snapshot(expected_snapshot, swh_storage) | ||||
expected_contents = map(hash_to_bytes, _expected_new_contents_first_visit) | |||||
assert list(swh_storage.content_missing_per_sha1(expected_contents)) == [] | |||||
expected_dirs = map(hash_to_bytes, _expected_new_directories_first_visit) | |||||
assert list(swh_storage.directory_missing(expected_dirs)) == [] | |||||
expected_revs = map(hash_to_bytes, _expected_new_revisions_first_visit) | |||||
assert list(swh_storage.revision_missing(expected_revs)) == [] | |||||
def test_archive_2_visits_without_change(swh_storage, requests_mock_datadir): | def test_archive_2_visits_without_change(swh_storage, requests_mock_datadir): | ||||
"""With no prior visit, load a gnu project ends up with 1 snapshot | """With no prior visit, load a gnu project ends up with 1 snapshot | ||||
""" | """ | ||||
url = URL | url = URL | ||||
loader = ArchiveLoader(swh_storage, url, artifacts=GNU_ARTIFACTS[:1]) | loader = ArchiveLoader(swh_storage, url, artifacts=GNU_ARTIFACTS[:1]) | ||||
▲ Show 20 Lines • Show All 278 Lines • Show Last 20 Lines |