feat(fastapi): add /pkgbase/{name}/comments/{id}/edit (get)

This is needed so that users can edit comments when they don't have
Javascript being used in their browser.

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2021-10-29 21:37:52 -07:00
parent 01e27fa347
commit 9464de108f
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
3 changed files with 66 additions and 0 deletions

View file

@ -1084,6 +1084,13 @@ def test_pkgbase_comments(client: TestClient, maintainer: User, user: User,
assert len(bodies) == 1
assert bodies[0].text.strip() == "Test comment."
comment_id = headers[0].attrib["id"].split("-")[-1]
# Test the non-javascript version of comment editing by
# visiting the /pkgbase/{name}/comments/{id}/edit route.
with client as request:
resp = request.get(f"{endpoint}/{comment_id}/edit", cookies=cookies)
assert resp.status_code == int(HTTPStatus.OK)
# Clear up the PackageNotification. This doubles as testing
# that the notification was created and clears it up so we can