mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
fix: search-by parameter for keyword links
Fixes: Keyword-links on the package page pass wrong query-parameter. Thus a name/description search is performed instead of keywords Issue report: #397 Signed-off-by: moson-mo <mo-son@mailbox.org>
This commit is contained in:
parent
a08681ba23
commit
7864ac6dfe
2 changed files with 13 additions and 1 deletions
|
@ -53,7 +53,7 @@
|
||||||
<td>
|
<td>
|
||||||
{% for keyword in pkgbase.keywords.all() %}
|
{% for keyword in pkgbase.keywords.all() %}
|
||||||
<a class="keyword"
|
<a class="keyword"
|
||||||
href="/packages/?K={{ keyword.Keyword }}&SB=p"
|
href="/packages/?K={{ keyword.Keyword }}&SeB=k"
|
||||||
>
|
>
|
||||||
{{ keyword.Keyword }}
|
{{ keyword.Keyword }}
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -271,6 +271,13 @@ def test_package(client: TestClient, package: Package):
|
||||||
db.create(PackageLicense, PackageID=package.ID, License=licenses[0])
|
db.create(PackageLicense, PackageID=package.ID, License=licenses[0])
|
||||||
db.create(PackageLicense, PackageID=package.ID, License=licenses[1])
|
db.create(PackageLicense, PackageID=package.ID, License=licenses[1])
|
||||||
|
|
||||||
|
# Create some keywords
|
||||||
|
keywords = ["test1", "test2"]
|
||||||
|
for keyword in keywords:
|
||||||
|
db.create(
|
||||||
|
PackageKeyword, PackageBaseID=package.PackageBaseID, Keyword=keyword
|
||||||
|
)
|
||||||
|
|
||||||
with client as request:
|
with client as request:
|
||||||
resp = request.get(package_endpoint(package))
|
resp = request.get(package_endpoint(package))
|
||||||
assert resp.status_code == int(HTTPStatus.OK)
|
assert resp.status_code == int(HTTPStatus.OK)
|
||||||
|
@ -307,6 +314,11 @@ def test_package(client: TestClient, package: Package):
|
||||||
expected = ["test_conflict1", "test_conflict2"]
|
expected = ["test_conflict1", "test_conflict2"]
|
||||||
assert conflicts[0].text.strip() == ", ".join(expected)
|
assert conflicts[0].text.strip() == ", ".join(expected)
|
||||||
|
|
||||||
|
keywords = root.xpath('//a[@class="keyword"]')
|
||||||
|
expected = ["test1", "test2"]
|
||||||
|
for i, keyword in enumerate(expected):
|
||||||
|
assert keywords[i].text.strip() == keyword
|
||||||
|
|
||||||
|
|
||||||
def test_package_split_description(client: TestClient, user: User):
|
def test_package_split_description(client: TestClient, user: User):
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue