Changeset View
Changeset View
Standalone View
Standalone View
swh/web/tests/common/test_archive.py
Show First 20 Lines • Show All 783 Lines • ▼ Show 20 Lines | |||||
def test_lookup_revision_through_with_context_by(archive_data, origin): | def test_lookup_revision_through_with_context_by(archive_data, origin): | ||||
branches = _get_origin_branches(archive_data, origin) | branches = _get_origin_branches(archive_data, origin) | ||||
branch_name = random.choice(list(branches.keys())) | branch_name = random.choice(list(branches.keys())) | ||||
root_rev = branches[branch_name]["target"] | root_rev = branches[branch_name]["target"] | ||||
root_rev_log = archive_data.revision_log(root_rev) | root_rev_log = archive_data.revision_log(root_rev) | ||||
rev = root_rev_log[-1]["id"] | rev = root_rev_log[-1]["id"] | ||||
assert archive.lookup_revision_through( | assert ( | ||||
archive.lookup_revision_through( | |||||
{ | { | ||||
"origin_url": origin["url"], | "origin_url": origin["url"], | ||||
"branch_name": branch_name, | "branch_name": branch_name, | ||||
"ts": None, | "ts": None, | ||||
"sha1_git": rev, | "sha1_git": rev, | ||||
} | } | ||||
) == archive.lookup_revision_with_context_by(origin["url"], branch_name, None, rev) | ) | ||||
== archive.lookup_revision_with_context_by( | |||||
origin["url"], branch_name, None, rev | |||||
) | |||||
) | |||||
def test_lookup_revision_through_with_revision_by(archive_data, origin): | def test_lookup_revision_through_with_revision_by(archive_data, origin): | ||||
branches = _get_origin_branches(archive_data, origin) | branches = _get_origin_branches(archive_data, origin) | ||||
branch_name = random.choice(list(branches.keys())) | branch_name = random.choice(list(branches.keys())) | ||||
assert archive.lookup_revision_through( | assert ( | ||||
archive.lookup_revision_through( | |||||
{ | { | ||||
"origin_url": origin["url"], | "origin_url": origin["url"], | ||||
"branch_name": branch_name, | "branch_name": branch_name, | ||||
"ts": None, | "ts": None, | ||||
} | } | ||||
) == archive.lookup_revision_by(origin["url"], branch_name, None) | ) | ||||
== archive.lookup_revision_by(origin["url"], branch_name, None) | |||||
) | |||||
def test_lookup_revision_through_with_context(ancestor_revisions): | def test_lookup_revision_through_with_context(ancestor_revisions): | ||||
sha1_git = ancestor_revisions["sha1_git"] | sha1_git = ancestor_revisions["sha1_git"] | ||||
sha1_git_root = ancestor_revisions["sha1_git_root"] | sha1_git_root = ancestor_revisions["sha1_git_root"] | ||||
assert archive.lookup_revision_through( | assert ( | ||||
archive.lookup_revision_through( | |||||
{ | { | ||||
"sha1_git_root": sha1_git_root, | "sha1_git_root": sha1_git_root, | ||||
"sha1_git": sha1_git, | "sha1_git": sha1_git, | ||||
} | } | ||||
) == archive.lookup_revision_with_context(sha1_git_root, sha1_git) | ) | ||||
== archive.lookup_revision_with_context(sha1_git_root, sha1_git) | |||||
) | |||||
def test_lookup_revision_through_with_revision(revision): | def test_lookup_revision_through_with_revision(revision): | ||||
assert archive.lookup_revision_through( | assert archive.lookup_revision_through( | ||||
{"sha1_git": revision} | {"sha1_git": revision} | ||||
) == archive.lookup_revision(revision) | ) == archive.lookup_revision(revision) | ||||
▲ Show 20 Lines • Show All 421 Lines • Show Last 20 Lines |