mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
feat: cancel button for comment editing
Adds button that allows cancellation while editing a comment Signed-off-by: moson-mo <mo-son@mailbox.org>
This commit is contained in:
parent
52c962a590
commit
7d1827ffc5
4 changed files with 35 additions and 0 deletions
|
@ -512,6 +512,26 @@ def test_pkgbase_comments(
|
|||
).first()
|
||||
assert db_notif is not None
|
||||
|
||||
# Now, let's edit again, but cancel.
|
||||
endpoint = f"/pkgbase/{pkgbasename}/comments/{comment_id}"
|
||||
with client as request:
|
||||
request.cookies = cookies
|
||||
resp = request.post(
|
||||
endpoint,
|
||||
data={"comment": "Edited comment with cancel.", "cancel": True},
|
||||
)
|
||||
assert resp.status_code == int(HTTPStatus.SEE_OTHER)
|
||||
|
||||
with client as request:
|
||||
resp = request.get(resp.headers.get("location"), follow_redirects=True)
|
||||
assert resp.status_code == int(HTTPStatus.OK)
|
||||
|
||||
root = parse_root(resp.text)
|
||||
bodies = root.xpath('//div[@class="article-content"]/div/p')
|
||||
|
||||
# Make sure our comment was NOT changed
|
||||
assert bodies[0].text.strip() == "Edited comment."
|
||||
|
||||
# Delete notification for next test.
|
||||
with db.begin():
|
||||
db.delete(db_notif)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue