Verified Commit 7864ac6d authored by Mario Oenning's avatar Mario Oenning
Browse files

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: Mario Oenning's avatarmoson-mo <mo-son@mailbox.org>
parent a08681ba
Pipeline #40526 passed with stages
in 2 minutes and 11 seconds
......@@ -53,7 +53,7 @@
<td>
{% for keyword in pkgbase.keywords.all() %}
<a class="keyword"
href="/packages/?K={{ keyword.Keyword }}&amp;SB=p"
href="/packages/?K={{ keyword.Keyword }}&amp;SeB=k"
>
{{ keyword.Keyword }}
</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[1])
# Create some keywords
keywords = ["test1", "test2"]
for keyword in keywords:
db.create(
PackageKeyword, PackageBaseID=package.PackageBaseID, Keyword=keyword
)
with client as request:
resp = request.get(package_endpoint(package))
assert resp.status_code == int(HTTPStatus.OK)
......@@ -307,6 +314,11 @@ def test_package(client: TestClient, package: Package):
expected = ["test_conflict1", "test_conflict2"]
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):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment