Skip to content
Snippets Groups Projects
Commit 4808fc2a authored by David Douard's avatar David Douard
Browse files

Fix snapshot entries in swh_model_data test data

make sure the snapshot id in OriginVisitStatus refers to existing
Snapshot objects.
parent 96cc355d
No related branches found
Tags v2.5.1
No related merge requests found
......@@ -243,7 +243,7 @@ ORIGIN_VISIT_STATUSES = [
visit=3,
type="git",
status="full",
snapshot=hash_to_bytes("17d0066a4a80aba4a0e913532ee8ff2014f006a9"),
snapshot=hash_to_bytes("9e78d7105c5e0f886487511e2a92377b4ee4c32a"),
metadata=None,
),
OriginVisitStatus(
......@@ -252,7 +252,7 @@ ORIGIN_VISIT_STATUSES = [
visit=2,
type="hg",
status="partial",
snapshot=hash_to_bytes("8ce268b87faf03850693673c3eb5c9bb66e1ca38"),
snapshot=hash_to_bytes("0e7f84ede9a254f2cd55649ad5240783f557e65f"),
metadata=None,
),
]
......@@ -293,7 +293,7 @@ SNAPSHOTS = [
},
),
Snapshot(
id=hash_to_bytes("09efffaaad8d1f9c7f9402db0266dbe28082853f"),
id=hash_to_bytes("0e7f84ede9a254f2cd55649ad5240783f557e65f"),
branches={
b"target/revision": SnapshotBranch(
target_type=TargetType.REVISION, target=REVISIONS[0].id,
......@@ -309,7 +309,7 @@ SNAPSHOTS = [
),
b"target/snapshot": SnapshotBranch(
target_type=TargetType.SNAPSHOT,
target=hash_to_bytes("17d0066a4a80aba4a0e913532ee8ff2014f006a9"),
target=hash_to_bytes("9e78d7105c5e0f886487511e2a92377b4ee4c32a"),
),
},
),
......
......@@ -28,7 +28,7 @@ def test_swh_model_data_hash(object_type):
), f"{obj.compute_hash().hex()} != {obj.id.hex()}"
def test_ensure_visit_visit_status_date_consistency():
def test_ensure_visit_status_date_consistency():
"""ensure origin-visit-status dates are more recent than their visit counterpart
The origin-visit-status dates needs to be shifted slightly in the future from their
......@@ -43,3 +43,12 @@ def test_ensure_visit_visit_status_date_consistency():
assert visit.origin == visit_status.origin
assert visit.visit == visit_status.visit
assert visit.date < visit_status.date
def test_ensure_visit_status_snapshot_consistency():
"""ensure origin-visit-status snapshots exist in the test dataset
"""
snapshots = [snp.id for snp in TEST_OBJECTS["snapshot"]]
for visit_status in TEST_OBJECTS["origin_visit_status"]:
if visit_status.snapshot:
assert visit_status.snapshot in snapshots
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment