mirror of
https://github.com/simple-login/app.git
synced 2025-02-23 07:13:18 +08:00
return title in /api/notifications
This commit is contained in:
parent
3422f038eb
commit
5b7949f346
3 changed files with 5 additions and 1 deletions
|
@ -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(),
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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"]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue