Changeset View
Changeset View
Standalone View
Standalone View
docker/tests/test_vault.py
Show All 12 Lines | |||||
def test_vault_directory(scheduler_host, git_origin): | def test_vault_directory(scheduler_host, git_origin): | ||||
# retrieve the root directory of the master branch of the ingested git | # retrieve the root directory of the master branch of the ingested git | ||||
# repository (by the git_origin fixture) | # repository (by the git_origin fixture) | ||||
visit = apiget(f"origin/{quote_plus(git_origin)}/visit/latest") | visit = apiget(f"origin/{quote_plus(git_origin)}/visit/latest") | ||||
snapshot = apiget(f'snapshot/{visit["snapshot"]}') | snapshot = apiget(f'snapshot/{visit["snapshot"]}') | ||||
rev_id = snapshot["branches"]["refs/heads/master"]["target"] | rev_id = snapshot["branches"]["refs/heads/master"]["target"] | ||||
rev_swhid = f'swh:1:rev:{rev_id}' | |||||
revision = apiget(f"revision/{rev_id}") | revision = apiget(f"revision/{rev_id}") | ||||
dir_id = revision["directory"] | dir_id = revision["directory"] | ||||
dir_swhid = f'swh:1:dir:{dir_id}' | dir_swhid = f"swh:1:dir:{dir_id}" | ||||
# now cook it | # now cook it | ||||
cook = apiget(f"vault/flat/{dir_swhid}/", "POST") | cook = apiget(f"vault/flat/{dir_swhid}/", "POST") | ||||
assert cook["swhid"] == dir_swhid | assert cook["swhid"] == dir_swhid | ||||
assert cook["fetch_url"].endswith(f"vault/flat/{dir_swhid}/raw/") | assert cook["fetch_url"].endswith(f"vault/flat/{dir_swhid}/raw/") | ||||
# while it's cooking, get the directory tree from the archive | # while it's cooking, get the directory tree from the archive | ||||
directory = getdirectory(dir_id) | directory = getdirectory(dir_id) | ||||
Show All 36 Lines |