Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/package/tests/test_common.py
Show All 35 Lines | def test_decode_target(): | ||||
assert actual_decode_target == { | assert actual_decode_target == { | ||||
'target_type': 'revision', | 'target_type': 'revision', | ||||
'target': hash_hex, | 'target': hash_hex, | ||||
} | } | ||||
def test_check_snapshot(): | def test_check_snapshot(): | ||||
storage = get_storage(cls='memory', args={}) | storage = get_storage(cls='memory') | ||||
snap_id = '2498dbf535f882bc7f9a18fb16c9ad27fda7bab7' | snap_id = '2498dbf535f882bc7f9a18fb16c9ad27fda7bab7' | ||||
snapshot = { | snapshot = { | ||||
'id': hash_to_bytes(snap_id), | 'id': hash_to_bytes(snap_id), | ||||
'branches': { | 'branches': { | ||||
b'master': { | b'master': { | ||||
'target': hash_to_bytes(hash_hex), | 'target': hash_to_bytes(hash_hex), | ||||
'target_type': 'revision', | 'target_type': 'revision', | ||||
Show All 14 Lines | expected_snapshot = { | ||||
'target_type': 'revision', | 'target_type': 'revision', | ||||
} | } | ||||
} | } | ||||
} | } | ||||
check_snapshot(expected_snapshot, storage) | check_snapshot(expected_snapshot, storage) | ||||
def test_check_snapshot_failure(): | def test_check_snapshot_failure(): | ||||
storage = get_storage(cls='memory', args={}) | storage = get_storage(cls='memory') | ||||
snapshot = { | snapshot = { | ||||
'id': hash_to_bytes('2498dbf535f882bc7f9a18fb16c9ad27fda7bab7'), | 'id': hash_to_bytes('2498dbf535f882bc7f9a18fb16c9ad27fda7bab7'), | ||||
'branches': { | 'branches': { | ||||
b'master': { | b'master': { | ||||
'target': hash_to_bytes(hash_hex), | 'target': hash_to_bytes(hash_hex), | ||||
'target_type': 'revision', | 'target_type': 'revision', | ||||
}, | }, | ||||
▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines |