mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
feat(FastAPI): add /pkgbase/{name}/comments/{id}/pin (post)
In addition, fix up some templates to display pinned comments, and include the unpin form input for pinned comments, which is not yet implemented. Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
bb45ae7ac3
commit
0895dd07ee
5 changed files with 100 additions and 14 deletions
|
@ -1143,3 +1143,29 @@ def test_pkgbase_comment_undelete_not_found(client: TestClient,
|
|||
with client as request:
|
||||
resp = request.post(endpoint, cookies=cookies)
|
||||
assert resp.status_code == int(HTTPStatus.NOT_FOUND)
|
||||
|
||||
|
||||
def test_pkgbase_comment_pin(client: TestClient,
|
||||
maintainer: User,
|
||||
package: Package,
|
||||
comment: PackageComment):
|
||||
cookies = {"AURSID": maintainer.login(Request(), "testPassword")}
|
||||
comment_id = comment.ID
|
||||
pkgbasename = package.PackageBase.Name
|
||||
endpoint = f"/pkgbase/{pkgbasename}/comments/{comment_id}/pin"
|
||||
with client as request:
|
||||
resp = request.post(endpoint, cookies=cookies)
|
||||
assert resp.status_code == int(HTTPStatus.SEE_OTHER)
|
||||
|
||||
|
||||
def test_pkgbase_comment_pin_unauthorized(client: TestClient,
|
||||
user: User,
|
||||
package: Package,
|
||||
comment: PackageComment):
|
||||
cookies = {"AURSID": user.login(Request(), "testPassword")}
|
||||
comment_id = comment.ID
|
||||
pkgbasename = package.PackageBase.Name
|
||||
endpoint = f"/pkgbase/{pkgbasename}/comments/{comment_id}/pin"
|
||||
with client as request:
|
||||
resp = request.post(endpoint, cookies=cookies)
|
||||
assert resp.status_code == int(HTTPStatus.UNAUTHORIZED)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue