diff --git a/swh/loader/package/cran/tests/test_cran.py b/swh/loader/package/cran/tests/test_cran.py --- a/swh/loader/package/cran/tests/test_cran.py +++ b/swh/loader/package/cran/tests/test_cran.py @@ -19,7 +19,7 @@ ) from swh.core.tarball import uncompress from swh.model.hashutil import hash_to_bytes -from swh.model.model import TimestampWithTimezone +from swh.model.model import Snapshot, SnapshotBranch, TargetType, TimestampWithTimezone from swh.loader.tests import ( assert_last_visit_matches, @@ -175,16 +175,18 @@ "snapshot_id": expected_snapshot_id, } - expected_snapshot = { - "id": hash_to_bytes(expected_snapshot_id), - "branches": { - b"HEAD": {"target": b"releases/2.22-6", "target_type": "alias"}, - b"releases/2.22-6": { - "target": hash_to_bytes("42bdb16facd5140424359c8ce89a28ecfa1ce603"), - "target_type": "revision", - }, + expected_snapshot = Snapshot( + id=hash_to_bytes(expected_snapshot_id), + branches={ + b"HEAD": SnapshotBranch( + target=b"releases/2.22-6", target_type=TargetType.ALIAS + ), + b"releases/2.22-6": SnapshotBranch( + target=hash_to_bytes("42bdb16facd5140424359c8ce89a28ecfa1ce603"), + target_type=TargetType.REVISION, + ), }, - } + ) check_snapshot(expected_snapshot, loader.storage) assert_last_visit_matches(loader.storage, origin_url, status="full", type="cran") @@ -232,16 +234,18 @@ "snapshot_id": expected_snapshot_id, } - expected_snapshot = { - "id": hash_to_bytes(expected_snapshot_id), - "branches": { - b"HEAD": {"target": b"releases/2.22-6", "target_type": "alias"}, - b"releases/2.22-6": { - "target": hash_to_bytes("42bdb16facd5140424359c8ce89a28ecfa1ce603"), - "target_type": "revision", - }, + expected_snapshot = Snapshot( + id=hash_to_bytes(expected_snapshot_id), + branches={ + b"HEAD": SnapshotBranch( + target=b"releases/2.22-6", target_type=TargetType.ALIAS + ), + b"releases/2.22-6": SnapshotBranch( + target=hash_to_bytes("42bdb16facd5140424359c8ce89a28ecfa1ce603"), + target_type=TargetType.REVISION, + ), }, - } + ) check_snapshot(expected_snapshot, loader.storage) assert_last_visit_matches(loader.storage, origin_url, status="full", type="cran")