diff options
author | 6543 <6543@obermui.de> | 2020-01-14 16:37:19 +0100 |
---|---|---|
committer | Antoine GIRARD <sapk@users.noreply.github.com> | 2020-01-14 16:37:19 +0100 |
commit | 44de66bf50d1ab9a5acc298063cd942768092a19 (patch) | |
tree | fda1b76b954d720dfdfefded22883a51ab52e45e /integrations/api_notification_test.go | |
parent | ce274d652f2be03364bc0d0a8cb1b4d1996b16c7 (diff) | |
download | gitea-44de66bf50d1ab9a5acc298063cd942768092a19.tar.gz gitea-44de66bf50d1ab9a5acc298063cd942768092a19.zip |
[API] add endpoint to check notifications [Extend #9488] (#9595)
* 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
Diffstat (limited to 'integrations/api_notification_test.go')
-rw-r--r-- | integrations/api_notification_test.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/integrations/api_notification_test.go b/integrations/api_notification_test.go index 2c5477dfb0..baab00f6d2 100644 --- a/integrations/api_notification_test.go +++ b/integrations/api_notification_test.go @@ -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) } |