Skip to content

Commit edec519

Browse files
authored
test: ensure links are created per-file (#16646)
1 parent 465079f commit edec519

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tests/functional/api/test_simple.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from http import HTTPStatus
1414

15-
from ...common.db.packaging import ProjectFactory, ReleaseFactory
15+
from ...common.db.packaging import FileFactory, ProjectFactory, ReleaseFactory
1616

1717

1818
def test_simple_api_html(webtest):
@@ -24,10 +24,13 @@ def test_simple_api_html(webtest):
2424

2525
def test_simple_api_detail(webtest):
2626
project = ProjectFactory.create()
27-
ReleaseFactory.create_batch(2, project=project)
27+
release = ReleaseFactory.create(project=project)
28+
FileFactory.create_batch(2, release=release, packagetype="bdist_wheel")
2829

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

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

0 commit comments

Comments
 (0)