mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
feat(FastAPI): add /pkgbase/{name}/flag-comment (get)
Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
210d92e382
commit
37f0c352f6
4 changed files with 81 additions and 5 deletions
|
@ -1707,6 +1707,14 @@ def test_pkgbase_flag(client: TestClient, user: User, maintainer: User,
|
|||
resp = request.get(endpoint, cookies=cookies)
|
||||
assert resp.status_code == int(HTTPStatus.OK)
|
||||
|
||||
# Now, let's check the /pkgbase/{name}/flag-comment route.
|
||||
flag_comment_endpoint = f"/pkgbase/{pkgbase.Name}/flag-comment"
|
||||
with client as request:
|
||||
resp = request.get(flag_comment_endpoint, cookies=cookies,
|
||||
allow_redirects=False)
|
||||
assert resp.status_code == int(HTTPStatus.SEE_OTHER)
|
||||
assert resp.headers.get("location") == f"/pkgbase/{pkgbase.Name}"
|
||||
|
||||
# Try to flag it without a comment.
|
||||
with client as request:
|
||||
resp = request.post(endpoint, cookies=cookies)
|
||||
|
@ -1721,6 +1729,13 @@ def test_pkgbase_flag(client: TestClient, user: User, maintainer: User,
|
|||
assert pkgbase.Flagger == user
|
||||
assert pkgbase.FlaggerComment == "Test"
|
||||
|
||||
# Now, let's check the /pkgbase/{name}/flag-comment route.
|
||||
flag_comment_endpoint = f"/pkgbase/{pkgbase.Name}/flag-comment"
|
||||
with client as request:
|
||||
resp = request.get(flag_comment_endpoint, cookies=cookies,
|
||||
allow_redirects=False)
|
||||
assert resp.status_code == int(HTTPStatus.OK)
|
||||
|
||||
# Now try to perform a get; we should be redirected because
|
||||
# it's already flagged.
|
||||
with client as request:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue