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. - notifications: list of notifications.
- id - id
- message - message
- title
- read - read
- created_at - created_at
""" """
@ -48,6 +49,7 @@ def get_notifications():
{ {
"id": notification.id, "id": notification.id,
"message": notification.message, "message": notification.message,
"title": notification.title,
"read": notification.read, "read": notification.read,
"created_at": notification.created_at.humanize(), "created_at": notification.created_at.humanize(),
} }

View File

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

View File

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