mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
feat(rpc): add "by" parameter - keywords
Add "by" parameter: keywords Signed-off-by: moson-mo <mo-son@mailbox.org>
This commit is contained in:
parent
5484e68b42
commit
efd20ed2c7
3 changed files with 34 additions and 3 deletions
|
@ -938,6 +938,25 @@ def test_rpc_search_submitter(client: TestClient, user2: User, packages: list[Pa
|
|||
assert data.get("resultcount") == 0
|
||||
|
||||
|
||||
def test_rpc_search_keywords(client: TestClient, packages: list[Package]):
|
||||
params = {"v": 5, "type": "search", "by": "keywords", "arg": "big-chungus"}
|
||||
with client as request:
|
||||
response = request.get("/rpc", params=params)
|
||||
data = response.json()
|
||||
|
||||
# should get 2 packages
|
||||
assert data.get("resultcount") == 1
|
||||
names = list(sorted(r.get("Name") for r in data.get("results")))
|
||||
expected_results = ["big-chungus"]
|
||||
assert names == expected_results
|
||||
|
||||
# non-existent search
|
||||
params["arg"] = "blah-blah"
|
||||
response = request.get("/rpc", params=params)
|
||||
data = response.json()
|
||||
assert data.get("resultcount") == 0
|
||||
|
||||
|
||||
def test_rpc_incorrect_by(client: TestClient):
|
||||
params = {"v": 5, "type": "search", "by": "fake", "arg": "big"}
|
||||
with client as request:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue