Merge branch 'master' into live

This commit is contained in:
Kevin Morris 2022-03-08 19:17:16 -08:00
commit 89f081a840
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
4 changed files with 21 additions and 4 deletions

View file

@ -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

View file

@ -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]

View file

@ -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"

View file

@ -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":