Skip to content
Snippets Groups Projects
Commit b5ed6955 authored by Antoine Lambert's avatar Antoine Lambert
Browse files

browse/snapshot_context: Ensure pull request branches can be browsed

While pull request branches are hidden by default in Web UI, they should
remain browsable.

That commit fixes the error that was previously raised when attempting
to browse such a branch.
parent b552b01d
No related branches found
No related tags found
No related merge requests found
......@@ -85,6 +85,9 @@ def _get_branch(branches, branch_name, snapshot_id):
branches_from=branch_name,
branches_count=1,
target_types=["revision", "alias"],
# pull request branches must be browsable even if they are hidden
# by default in branches list
branch_name_exclude_prefix=None,
)
snp_branch, _, _ = process_snapshot_branches(snp)
if snp_branch and snp_branch[0]["name"] == branch_name:
......
......@@ -1297,3 +1297,22 @@ def test_pull_request_branches_filtering(client, origin):
client, url, status_code=200, template_used="browse/branches.html"
)
assert_not_contains(resp, "refs/pull/")
@given(origin_with_pull_request_branches())
def test_browse_pull_request_branch(client, archive_data, origin):
snapshot = archive_data.snapshot_get_latest(origin.url)
pr_branch = random.choice(
[
branch
for branch in snapshot["branches"].keys()
if branch.startswith("refs/pull/")
]
)
url = reverse(
"browse-origin-directory",
query_params={"origin_url": origin.url, "branch": pr_branch},
)
check_html_get_response(
client, url, status_code=200, template_used="browse/directory.html"
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment