mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
test: test that /packages/{name} produces the package's description
This commit fixes two of our tests in test_templates.py to go along with our new template modifications, as well as a new test in test_packages_routes.py which constructs two packages belonging to the same package base, then tests that viewing their pages produces their independent descriptions. Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
0388b12896
commit
25e05830a6
3 changed files with 47 additions and 3 deletions
|
@ -17,7 +17,7 @@
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr id="pkg-description">
|
||||||
<th>{{ "Description" | tr }}:</th>
|
<th>{{ "Description" | tr }}:</th>
|
||||||
<td class="wrap">{{ package.Description }}</td>
|
<td class="wrap">{{ package.Description }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -304,6 +304,50 @@ def test_package(client: TestClient, package: Package):
|
||||||
assert conflicts[0].text.strip() == ", ".join(expected)
|
assert conflicts[0].text.strip() == ", ".join(expected)
|
||||||
|
|
||||||
|
|
||||||
|
def test_package_split_description(client: TestClient, user: User):
|
||||||
|
|
||||||
|
with db.begin():
|
||||||
|
pkgbase = db.create(
|
||||||
|
PackageBase,
|
||||||
|
Name="pkgbase",
|
||||||
|
Maintainer=user,
|
||||||
|
Packager=user,
|
||||||
|
)
|
||||||
|
|
||||||
|
pkg_a = db.create(
|
||||||
|
Package,
|
||||||
|
PackageBase=pkgbase,
|
||||||
|
Name="pkg_a",
|
||||||
|
Description="pkg_a desc",
|
||||||
|
)
|
||||||
|
pkg_b = db.create(
|
||||||
|
Package,
|
||||||
|
PackageBase=pkgbase,
|
||||||
|
Name="pkg_b",
|
||||||
|
Description="pkg_b desc",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Check pkg_a
|
||||||
|
with client as request:
|
||||||
|
endp = f"/packages/{pkg_a.Name}"
|
||||||
|
resp = request.get(endp)
|
||||||
|
assert resp.status_code == HTTPStatus.OK
|
||||||
|
|
||||||
|
root = parse_root(resp.text)
|
||||||
|
row = root.xpath('//tr[@id="pkg-description"]/td')[0]
|
||||||
|
assert row.text == pkg_a.Description
|
||||||
|
|
||||||
|
# Check pkg_b
|
||||||
|
with client as request:
|
||||||
|
endp = f"/packages/{pkg_b.Name}"
|
||||||
|
resp = request.get(endp)
|
||||||
|
assert resp.status_code == HTTPStatus.OK
|
||||||
|
|
||||||
|
root = parse_root(resp.text)
|
||||||
|
row = root.xpath('//tr[@id="pkg-description"]/td')[0]
|
||||||
|
assert row.text == pkg_b.Description
|
||||||
|
|
||||||
|
|
||||||
def paged_depends_required(client: TestClient, package: Package):
|
def paged_depends_required(client: TestClient, package: Package):
|
||||||
maint = package.PackageBase.Maintainer
|
maint = package.PackageBase.Maintainer
|
||||||
new_pkgs = []
|
new_pkgs = []
|
||||||
|
|
|
@ -293,7 +293,7 @@ def test_package_details(user: User, package: Package):
|
||||||
"git_clone_uri_anon": GIT_CLONE_URI_ANON,
|
"git_clone_uri_anon": GIT_CLONE_URI_ANON,
|
||||||
"git_clone_uri_priv": GIT_CLONE_URI_PRIV,
|
"git_clone_uri_priv": GIT_CLONE_URI_PRIV,
|
||||||
"pkgbase": package.PackageBase,
|
"pkgbase": package.PackageBase,
|
||||||
"pkg": package,
|
"package": package,
|
||||||
"comaintainers": [],
|
"comaintainers": [],
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -329,7 +329,7 @@ def test_package_details_filled(user: User, package: Package):
|
||||||
"git_clone_uri_anon": GIT_CLONE_URI_ANON,
|
"git_clone_uri_anon": GIT_CLONE_URI_ANON,
|
||||||
"git_clone_uri_priv": GIT_CLONE_URI_PRIV,
|
"git_clone_uri_priv": GIT_CLONE_URI_PRIV,
|
||||||
"pkgbase": package.PackageBase,
|
"pkgbase": package.PackageBase,
|
||||||
"pkg": package,
|
"package": package,
|
||||||
"comaintainers": [],
|
"comaintainers": [],
|
||||||
"licenses": package.package_licenses,
|
"licenses": package.package_licenses,
|
||||||
"provides": package.package_relations.filter(
|
"provides": package.package_relations.filter(
|
||||||
|
|
Loading…
Add table
Reference in a new issue