Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/tests/test_init.py
Show First 20 Lines • Show All 394 Lines • ▼ Show 20 Lines | unexpected_snapshot = Snapshot( | ||||
branches={ | branches={ | ||||
b"tip": SnapshotBranch( # wrong branch | b"tip": SnapshotBranch( # wrong branch | ||||
target=hash_to_bytes(hash_hex), target_type=TargetType.RELEASE | target=hash_to_bytes(hash_hex), target_type=TargetType.RELEASE | ||||
) | ) | ||||
}, | }, | ||||
) | ) | ||||
# 0. not a Snapshot object, raise! | # 0. not a Snapshot object, raise! | ||||
with pytest.raises(AssertionError, match="variable 'snapshot' must be a snapshot"): | with pytest.raises( | ||||
AssertionError, match="argument 'expected_snapshot' must be a snapshot" | |||||
): | |||||
check_snapshot(ORIGIN_VISIT, swh_storage) | check_snapshot(ORIGIN_VISIT, swh_storage) | ||||
# 1. snapshot id is correct but branches mismatched | # 1. snapshot id is correct but branches mismatched | ||||
with pytest.raises(AssertionError): # sadly debian build raises only assertion | with pytest.raises(AssertionError): # sadly debian build raises only assertion | ||||
check_snapshot(attr.evolve(unexpected_snapshot, id=snapshot.id), swh_storage) | check_snapshot(attr.evolve(unexpected_snapshot, id=snapshot.id), swh_storage) | ||||
# 2. snapshot id is not correct, it's not found in the storage | # 2. snapshot id is not correct, it's not found in the storage | ||||
wrong_snap_id = hash_to_bytes("999666f535f882bc7f9a18fb16c9ad27fda7bab7") | wrong_snap_id = hash_to_bytes("999666f535f882bc7f9a18fb16c9ad27fda7bab7") | ||||
▲ Show 20 Lines • Show All 105 Lines • Show Last 20 Lines |