Changeset View
Changeset View
Standalone View
Standalone View
swh/web/tests/strategies.py
Show First 20 Lines • Show All 395 Lines • ▼ Show 20 Lines | return sha1().filter( | ||||
lambda s: storage.snapshot_get(hash_to_bytes(s)) is None) | lambda s: storage.snapshot_get(hash_to_bytes(s)) is None) | ||||
def _get_origin_dfs_revisions_walker(): | def _get_origin_dfs_revisions_walker(): | ||||
tests_data = get_tests_data() | tests_data = get_tests_data() | ||||
storage = tests_data['storage'] | storage = tests_data['storage'] | ||||
origin = random.choice(tests_data['origins'][:-1]) | origin = random.choice(tests_data['origins'][:-1]) | ||||
snapshot = storage.snapshot_get_latest(origin['url']) | snapshot = storage.snapshot_get_latest(origin['url']) | ||||
if snapshot['branches'][b'HEAD']['target_type'] == 'alias': | |||||
target = snapshot['branches'][b'HEAD']['target'] | |||||
head = snapshot['branches'][target]['target'] | |||||
else: | |||||
head = snapshot['branches'][b'HEAD']['target'] | head = snapshot['branches'][b'HEAD']['target'] | ||||
return get_revisions_walker('dfs', storage, head) | return get_revisions_walker('dfs', storage, head) | ||||
def ancestor_revisions(): | def ancestor_revisions(): | ||||
""" | """ | ||||
Hypothesis strategy returning a pair of revisions ingested into the | Hypothesis strategy returning a pair of revisions ingested into the | ||||
test archive with an ancestor relation. | test archive with an ancestor relation. | ||||
""" | """ | ||||
▲ Show 20 Lines • Show All 100 Lines • Show Last 20 Lines |