mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
feat: switch requests filter for pkgname to "contains"
Use "contains" filtering instead of an exact match when a package name filter is given. This makes it easier to find requests for a "group" of packages. Signed-off-by: moson-mo <mo-son@mailbox.org>
This commit is contained in:
parent
26b2566b3f
commit
1c11c901a2
2 changed files with 19 additions and 5 deletions
|
@ -925,14 +925,28 @@ def test_requests_with_package_name_filter(
|
|||
request.cookies = cookies
|
||||
resp = request.get(
|
||||
"/requests",
|
||||
params={"filter_pkg_name": packages[0].PackageBase.Name},
|
||||
params={"filter_pkg_name": "kg_1"},
|
||||
)
|
||||
assert resp.status_code == int(HTTPStatus.OK)
|
||||
|
||||
root = parse_root(resp.text)
|
||||
rows = root.xpath('//table[@class="results"]/tbody/tr')
|
||||
# We only expect 1 request for our first package
|
||||
assert len(rows) == 1
|
||||
# We expect 11 requests for all packages containing "kg_1"
|
||||
assert len(rows) == 11
|
||||
|
||||
# test as TU, no results
|
||||
with client as request:
|
||||
request.cookies = cookies
|
||||
resp = request.get(
|
||||
"/requests",
|
||||
params={"filter_pkg_name": "x"},
|
||||
)
|
||||
assert resp.status_code == int(HTTPStatus.OK)
|
||||
|
||||
root = parse_root(resp.text)
|
||||
rows = root.xpath('//table[@class="results"]/tbody/tr')
|
||||
# We expect 0 requests since we don't have anything containing "x"
|
||||
assert len(rows) == 0
|
||||
|
||||
# test as regular user, not related to our package
|
||||
cookies = {"AURSID": user2.login(Request(), "testPassword")}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue