Changeset View
Changeset View
Standalone View
Standalone View
swh/web/tests/strategies.py
Show First 20 Lines • Show All 191 Lines • ▼ Show 20 Lines | def unknown_snapshot(draw): | ||||
Hypothesis strategy returning a random revision not ingested | Hypothesis strategy returning a random revision not ingested | ||||
into the test archive. | into the test archive. | ||||
""" | """ | ||||
return _unknown_swh_object(draw, 'snapshots') | return _unknown_swh_object(draw, 'snapshots') | ||||
def _get_origin_dfs_revisions_walker(): | def _get_origin_dfs_revisions_walker(): | ||||
storage = get_tests_data()['storage'] | storage = get_tests_data()['storage'] | ||||
origin = random.choice(get_tests_data()['origins']) | origin = random.choice(get_tests_data()['origins'][:-1]) | ||||
snapshot = storage.snapshot_get_latest(origin['id']) | snapshot = storage.snapshot_get_latest(origin['id']) | ||||
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 | ||||
▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | return just({ | ||||
'9b3557f1ab4111c8607a4f2ea3c1e53c6992916c', | '9b3557f1ab4111c8607a4f2ea3c1e53c6992916c', | ||||
'9c20da07ed14dc4fcd3ca2b055af99b2598d8bdd', | '9c20da07ed14dc4fcd3ca2b055af99b2598d8bdd', | ||||
'c20ceebd6ec6f7a19b5c3aebc512a12fbdc9234b', | 'c20ceebd6ec6f7a19b5c3aebc512a12fbdc9234b', | ||||
'e89e55a12def4cd54d5bff58378a3b5119878eb7', | 'e89e55a12def4cd54d5bff58378a3b5119878eb7', | ||||
'e8c0654fe2d75ecd7e0b01bee8a8fc60a130097e', | 'e8c0654fe2d75ecd7e0b01bee8a8fc60a130097e', | ||||
'eb6595e559a1d34a2b41e8d4835e0e4f98a5d2b5'], | 'eb6595e559a1d34a2b41e8d4835e0e4f98a5d2b5'], | ||||
'symbol_name': 'ABS' | 'symbol_name': 'ABS' | ||||
}) | }) | ||||
def revision_with_submodules(): | |||||
""" | |||||
Hypothesis strategy returning a revision that is known to | |||||
point to a directory with revision entries (aka git submodule) | |||||
""" | |||||
return just({ | |||||
'rev_sha1_git': 'ffcb69001f3f6745dfd5b48f72ab6addb560e234', | |||||
'rev_dir_sha1_git': 'd92a21446387fa28410e5a74379c934298f39ae2', | |||||
'rev_dir_rev_path': 'libtess2' | |||||
}) |