mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
fix: send notifications when users submit comments
Closes #278 Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
a2e993119e
commit
50b726d739
2 changed files with 12 additions and 0 deletions
|
@ -370,6 +370,12 @@ def test_pkgbase_comments(client: TestClient, maintainer: User, user: User,
|
|||
- GET /pkgbase/{name}/comments/{id}/form
|
||||
- Tested against a comment created with the POST route
|
||||
"""
|
||||
with db.begin():
|
||||
user.CommentNotify = 1
|
||||
db.create(PackageNotification,
|
||||
PackageBase=package.PackageBase,
|
||||
User=user)
|
||||
|
||||
cookies = {"AURSID": maintainer.login(Request(), "testPassword")}
|
||||
pkgbasename = package.PackageBase.Name
|
||||
endpoint = f"/pkgbase/{pkgbasename}/comments"
|
||||
|
@ -380,6 +386,9 @@ def test_pkgbase_comments(client: TestClient, maintainer: User, user: User,
|
|||
}, cookies=cookies)
|
||||
assert resp.status_code == int(HTTPStatus.SEE_OTHER)
|
||||
|
||||
# user should've gotten a CommentNotification email.
|
||||
assert Email.count() == 1
|
||||
|
||||
expected_prefix = f"/pkgbase/{pkgbasename}"
|
||||
prefix_len = len(expected_prefix)
|
||||
assert resp.headers.get("location")[:prefix_len] == expected_prefix
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue