Skip to content

test: ensure links are created per-file #16646

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions tests/functional/api/test_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from http import HTTPStatus

from ...common.db.packaging import ProjectFactory, ReleaseFactory
from ...common.db.packaging import FileFactory, ProjectFactory, ReleaseFactory


def test_simple_api_html(webtest):
Expand All @@ -24,10 +24,13 @@ def test_simple_api_html(webtest):

def test_simple_api_detail(webtest):
project = ProjectFactory.create()
ReleaseFactory.create_batch(2, project=project)
release = ReleaseFactory.create(project=project)
FileFactory.create_batch(2, release=release, packagetype="bdist_wheel")

resp = webtest.get(f"/simple/{project.normalized_name}/", status=HTTPStatus.OK)

assert resp.content_type == "text/html"
assert "X-PyPI-Last-Serial" in resp.headers
assert f"Links for {project.normalized_name}" in resp.text
assert resp.html.h1.string == f"Links for {project.normalized_name}"
# There should be a link for every file
assert len(resp.html.find_all("a")) == 2