forked from forgejo/forgejo
* introduce GET /notifications/new * add TEST * use Sprintf instead of path.Join * Error more verbose * return number of notifications if unreaded exist * 200 http status for available notifications
This commit is contained in:
parent
ce274d652f
commit
44de66bf50
9 changed files with 107 additions and 5 deletions
|
@ -81,6 +81,10 @@ func TestAPINotification(t *testing.T) {
|
|||
assert.EqualValues(t, thread5.Issue.APIURL(), apiN.Subject.URL)
|
||||
assert.EqualValues(t, thread5.Repository.HTMLURL(), apiN.Repository.HTMLURL)
|
||||
|
||||
// -- check notifications --
|
||||
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/notifications/new?token=%s", token))
|
||||
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
// -- mark notifications as read --
|
||||
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/notifications?token=%s", token))
|
||||
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||
|
@ -103,4 +107,8 @@ func TestAPINotification(t *testing.T) {
|
|||
assert.Equal(t, models.NotificationStatusUnread, thread5.Status)
|
||||
thread5 = models.AssertExistsAndLoadBean(t, &models.Notification{ID: 5}).(*models.Notification)
|
||||
assert.Equal(t, models.NotificationStatusRead, thread5.Status)
|
||||
|
||||
// -- check notifications --
|
||||
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/notifications/new?token=%s", token))
|
||||
resp = session.MakeRequest(t, req, http.StatusNoContent)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue