diff --git a/swh/model/tests/swh_model_data.py b/swh/model/tests/swh_model_data.py --- a/swh/model/tests/swh_model_data.py +++ b/swh/model/tests/swh_model_data.py @@ -120,7 +120,7 @@ ), ), Revision( - id=hash_to_bytes("677063f5c405d6fc1781fc56379c9a9adf43d3a0"), + id=hash_to_bytes("c7f96242d73c267adc77c2908e64e0c1cb6a4431"), message=b"hello again", date=DATES[1], committer=COMMITTERS[1], @@ -261,7 +261,7 @@ DIRECTORIES = [ Directory(id=hash_to_bytes("4b825dc642cb6eb9a060e54bf8d69288fbee4904"), entries=()), Directory( - id=hash_to_bytes("21416d920e0ebf0df4a7888bed432873ed5cb3a7"), + id=hash_to_bytes("87b339104f7dc2a8163dec988445e3987995545f"), entries=( DirectoryEntry( name=b"file1.ext", @@ -285,7 +285,7 @@ SNAPSHOTS = [ Snapshot( - id=hash_to_bytes("17d0066a4a80aba4a0e913532ee8ff2014f006a9"), + id=hash_to_bytes("9e78d7105c5e0f886487511e2a92377b4ee4c32a"), branches={ b"master": SnapshotBranch( target_type=TargetType.REVISION, target=REVISIONS[0].id @@ -293,7 +293,7 @@ }, ), Snapshot( - id=hash_to_bytes("8ce268b87faf03850693673c3eb5c9bb66e1ca38"), + id=hash_to_bytes("09efffaaad8d1f9c7f9402db0266dbe28082853f"), branches={ b"target/revision": SnapshotBranch( target_type=TargetType.REVISION, target=REVISIONS[0].id, diff --git a/swh/model/tests/test_swh_model_data.py b/swh/model/tests/test_swh_model_data.py --- a/swh/model/tests/test_swh_model_data.py +++ b/swh/model/tests/test_swh_model_data.py @@ -18,6 +18,16 @@ attr.validate(obj) +@pytest.mark.parametrize( + "object_type", ("directory", "revision", "release", "snapshot"), +) +def test_swh_model_data_hash(object_type): + for obj in TEST_OBJECTS[object_type]: + assert ( + obj.compute_hash() == obj.id + ), f"{obj.compute_hash().hex()} != {obj.id.hex()}" + + def test_ensure_visit_visit_status_date_consistency(): """ensure origin-visit-status dates are more recent than their visit counterpart