return title in /api/notifications

This commit is contained in:
Son 2022-01-24 15:20:59 +01:00
parent 3422f038eb
commit 5b7949f346
3 changed files with 5 additions and 1 deletions

View File

@ -22,6 +22,7 @@ def get_notifications():
- notifications: list of notifications.
- id
- message
- title
- read
- created_at
"""
@ -48,6 +49,7 @@ def get_notifications():
{
"id": notification.id,
"message": notification.message,
"title": notification.title,
"read": notification.read,
"created_at": notification.created_at.humanize(),
}

View File

@ -820,6 +820,7 @@ Output:
- notifications: list of notification, each notification has:
- id
- message: the message in html
- title: the message title
- read: whether the user has read the notification
- created_at: when the notification is created

View File

@ -20,7 +20,7 @@ def test_get_notifications(flask_client):
Session.commit()
r = flask_client.get(
url_for("api.get_notifications", page=0),
"/api/notifications?page=0",
headers={"Authentication": api_key.code},
)
@ -30,6 +30,7 @@ def test_get_notifications(flask_client):
for n in r.json["notifications"]:
assert n["id"] > 0
assert n["message"]
assert "title" in n
assert n["read"] is False
assert n["created_at"]