mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Merge branch 'master' into live
This commit is contained in:
commit
89f081a840
4 changed files with 21 additions and 4 deletions
|
@ -6,7 +6,7 @@ from typing import Any
|
|||
# Publicly visible version of aurweb. This is used to display
|
||||
# aurweb versioning in the footer and must be maintained.
|
||||
# Todo: Make this dynamic/automated.
|
||||
AURWEB_VERSION = "v6.0.23"
|
||||
AURWEB_VERSION = "v6.0.24"
|
||||
|
||||
_parser = None
|
||||
|
||||
|
|
|
@ -332,7 +332,7 @@ class RPC:
|
|||
models.PackageBase
|
||||
).filter(
|
||||
and_(models.PackageBase.PackagerUID.isnot(None),
|
||||
models.Package.Name.like(f"%{arg}%"))
|
||||
models.Package.Name.like(f"{arg}%"))
|
||||
).order_by(models.Package.Name.asc()).limit(20)
|
||||
return [pkg.Name for pkg in packages]
|
||||
|
||||
|
@ -341,9 +341,10 @@ class RPC:
|
|||
if not args:
|
||||
return []
|
||||
|
||||
arg = args[0]
|
||||
packages = db.query(models.PackageBase.Name).filter(
|
||||
and_(models.PackageBase.PackagerUID.isnot(None),
|
||||
models.PackageBase.Name.like(f"%{args[0]}%"))
|
||||
models.PackageBase.Name.like(f"{arg}%"))
|
||||
).order_by(models.PackageBase.Name.asc()).limit(20)
|
||||
return [pkg.Name for pkg in packages]
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#
|
||||
[tool.poetry]
|
||||
name = "aurweb"
|
||||
version = "v6.0.23"
|
||||
version = "v6.0.24"
|
||||
license = "GPL-2.0-only"
|
||||
description = "Source code for the Arch User Repository's website"
|
||||
homepage = "https://aur.archlinux.org"
|
||||
|
|
|
@ -551,6 +551,14 @@ def test_rpc_suggest_pkgbase(client: TestClient, packages: List[Package]):
|
|||
data = response.json()
|
||||
assert data == []
|
||||
|
||||
# Test that suggestions are only given based on the beginning
|
||||
# of the keyword string.
|
||||
params["arg"] = "ther-pkg"
|
||||
with client as request:
|
||||
response = request.get("/rpc", params=params)
|
||||
data = response.json()
|
||||
assert data == []
|
||||
|
||||
|
||||
def test_rpc_suggest(client: TestClient, packages: List[Package]):
|
||||
params = {"v": 5, "type": "suggest", "arg": "other"}
|
||||
|
@ -573,6 +581,14 @@ def test_rpc_suggest(client: TestClient, packages: List[Package]):
|
|||
data = response.json()
|
||||
assert data == []
|
||||
|
||||
# Test that suggestions are only given based on the beginning
|
||||
# of the keyword string.
|
||||
params["arg"] = "ther-pkg"
|
||||
with client as request:
|
||||
response = request.get("/rpc", params=params)
|
||||
data = response.json()
|
||||
assert data == []
|
||||
|
||||
|
||||
def mock_config_getint(section: str, key: str):
|
||||
if key == "request_limit":
|
||||
|
|
Loading…
Add table
Reference in a new issue