mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
feat(fastapi): add comment actions to /account/{username}/comments
With this change, we've decoupled some partials shared between `/pkgbase/{name}` and `/account/{username}/comments`. The comment actions template now resolves its package base via the `comment` instance instead of requiring `pkgbase`. We've also modified the existing package comment routes to support execution from any location using the `next` parameter. This allows us to reuse code from package comments for account comments actions. Moved the majority of comment editing javascript to its own .js file. Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
adb6252f85
commit
691b7b9091
12 changed files with 276 additions and 182 deletions
|
@ -1625,3 +1625,10 @@ def test_post_terms_of_service():
|
|||
response = request.get("/tos", cookies=cookies, allow_redirects=False)
|
||||
assert response.status_code == int(HTTPStatus.SEE_OTHER)
|
||||
assert response.headers.get("location") == "/"
|
||||
|
||||
|
||||
def test_account_comments_not_found():
|
||||
cookies = {"AURSID": user.login(Request(), "testPassword")}
|
||||
with client as request:
|
||||
resp = request.get("/account/non-existent/comments", cookies=cookies)
|
||||
assert resp.status_code == int(HTTPStatus.NOT_FOUND)
|
||||
|
|
|
@ -1055,6 +1055,13 @@ def test_pkgbase_comments_missing_comment(client: TestClient, maintainer: User,
|
|||
|
||||
def test_pkgbase_comments(client: TestClient, maintainer: User, user: User,
|
||||
package: Package):
|
||||
""" This test includes tests against the following routes:
|
||||
- POST /pkgbase/{name}/comments
|
||||
- GET /pkgbase/{name} (to check comments)
|
||||
- Tested against a comment created with the POST route
|
||||
- GET /pkgbase/{name}/comments/{id}/form
|
||||
- Tested against a comment created with the POST route
|
||||
"""
|
||||
cookies = {"AURSID": maintainer.login(Request(), "testPassword")}
|
||||
pkgbasename = package.PackageBase.Name
|
||||
endpoint = f"/pkgbase/{pkgbasename}/comments"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue