Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/package/opam/tests/test_opam.py
Show First 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | expected_snapshot = Snapshot( | ||||
id=expected_snapshot_id, | id=expected_snapshot_id, | ||||
branches={ | branches={ | ||||
b"HEAD": SnapshotBranch(target=b"agrid.0.1", target_type=TargetType.ALIAS,), | b"HEAD": SnapshotBranch(target=b"agrid.0.1", target_type=TargetType.ALIAS,), | ||||
b"agrid.0.1": SnapshotBranch( | b"agrid.0.1": SnapshotBranch( | ||||
target=target, target_type=TargetType.REVISION, | target=target, target_type=TargetType.REVISION, | ||||
), | ), | ||||
}, | }, | ||||
) | ) | ||||
check_snapshot(expected_snapshot, swh_storage) | |||||
assert_last_visit_matches( | assert_last_visit_matches( | ||||
swh_storage, url, status="full", type="opam", snapshot=expected_snapshot_id | swh_storage, url, status="full", type="opam", snapshot=expected_snapshot_id | ||||
) | ) | ||||
check_snapshot(expected_snapshot, swh_storage) | |||||
stats = get_stats(swh_storage) | stats = get_stats(swh_storage) | ||||
assert { | assert { | ||||
"content": 18, | "content": 18, | ||||
"directory": 8, | "directory": 8, | ||||
"origin": 1, | "origin": 1, | ||||
"origin_visit": 1, | "origin_visit": 1, | ||||
"release": 0, | "release": 0, | ||||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | expected_snapshot = Snapshot( | ||||
), | ), | ||||
b"directories.0.3": SnapshotBranch( | b"directories.0.3": SnapshotBranch( | ||||
target=b"hA \xc4\xb5\x18A8\xb8C\x12\xa3\xa5T\xb7/v\x85X\xcb", | target=b"hA \xc4\xb5\x18A8\xb8C\x12\xa3\xa5T\xb7/v\x85X\xcb", | ||||
target_type=TargetType.REVISION, | target_type=TargetType.REVISION, | ||||
), | ), | ||||
}, | }, | ||||
) | ) | ||||
check_snapshot(expected_snapshot, swh_storage) | |||||
assert_last_visit_matches( | assert_last_visit_matches( | ||||
swh_storage, url, status="full", type="opam", snapshot=expected_snapshot_id | swh_storage, url, status="full", type="opam", snapshot=expected_snapshot_id | ||||
) | ) | ||||
check_snapshot(expected_snapshot, swh_storage) | |||||
def test_opam_revision(tmpdir, requests_mock_datadir, swh_storage, datadir): | def test_opam_revision(tmpdir, requests_mock_datadir, swh_storage, datadir): | ||||
opam_url = f"file://{datadir}/fake_opam_repo" | opam_url = f"file://{datadir}/fake_opam_repo" | ||||
opam_root = tmpdir | opam_root = tmpdir | ||||
opam_instance = "loadertest" | opam_instance = "loadertest" | ||||
opam_package = "ocb" | opam_package = "ocb" | ||||
▲ Show 20 Lines • Show All 106 Lines • Show Last 20 Lines |