Changeset View
Changeset View
Standalone View
Standalone View
swh/web/tests/browse/views/test_origin.py
Show All 31 Lines | |||||
) | ) | ||||
from swh.web.tests.data import get_content, random_sha1 | from swh.web.tests.data import get_content, random_sha1 | ||||
from swh.web.tests.django_asserts import assert_contains, assert_not_contains | from swh.web.tests.django_asserts import assert_contains, assert_not_contains | ||||
from swh.web.tests.strategies import ( | from swh.web.tests.strategies import ( | ||||
new_origin, | new_origin, | ||||
new_snapshot, | new_snapshot, | ||||
origin, | origin, | ||||
origin_with_multiple_visits, | origin_with_multiple_visits, | ||||
origin_with_pull_request_branches, | |||||
origin_with_releases, | origin_with_releases, | ||||
) | ) | ||||
from swh.web.tests.strategies import release as existing_release | from swh.web.tests.strategies import release as existing_release | ||||
from swh.web.tests.strategies import revisions, unknown_revision, visit_dates | from swh.web.tests.strategies import revisions, unknown_revision, visit_dates | ||||
from swh.web.tests.utils import check_html_get_response | from swh.web.tests.utils import check_html_get_response | ||||
@given(origin_with_multiple_visits()) | @given(origin_with_multiple_visits()) | ||||
▲ Show 20 Lines • Show All 1,227 Lines • ▼ Show 20 Lines | ): | ||||
assert_contains(resp, '<ul class="pagination') | assert_contains(resp, '<ul class="pagination') | ||||
def _check_origin_link(resp, origin_url): | def _check_origin_link(resp, origin_url): | ||||
browse_origin_url = reverse( | browse_origin_url = reverse( | ||||
"browse-origin", query_params={"origin_url": origin_url} | "browse-origin", query_params={"origin_url": origin_url} | ||||
) | ) | ||||
assert_contains(resp, f'href="{browse_origin_url}"') | assert_contains(resp, f'href="{browse_origin_url}"') | ||||
@given(origin_with_pull_request_branches()) | |||||
def test_pull_request_branches_filtering(client, origin): | |||||
# check no pull request branches are displayed in the Branches / Releases dropdown | |||||
url = reverse("browse-origin-directory", query_params={"origin_url": origin.url}) | |||||
resp = check_html_get_response( | |||||
client, url, status_code=200, template_used="browse/directory.html" | |||||
) | |||||
assert_not_contains(resp, "refs/pull/") | |||||
# check no pull request branches are displayed in the branches view | |||||
url = reverse("browse-origin-branches", query_params={"origin_url": origin.url}) | |||||
resp = check_html_get_response( | |||||
client, url, status_code=200, template_used="browse/branches.html" | |||||
) | |||||
assert_not_contains(resp, "refs/pull/") |