summaryrefslogtreecommitdiffstats
path: root/integrations
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2020-04-11 01:49:39 +0200
committerGitHub <noreply@github.com>2020-04-10 19:49:39 -0400
commit0dadea19bcc469937d0b2376db031a46cfcfb742 (patch)
tree302c8b72a3b76743ff0e4cfd806b3aca450ab434 /integrations
parentc97e9883801d28ca44b8b7049a4285c8d904eea8 (diff)
downloadgitea-0dadea19bcc469937d0b2376db031a46cfcfb742.tar.gz
gitea-0dadea19bcc469937d0b2376db031a46cfcfb742.zip
[Api] Check Notify (always return json) (#10059)
* BEAKING: check return status based on struct not httpStatus * update Tests * CI.restart()
Diffstat (limited to 'integrations')
-rw-r--r--integrations/api_notification_test.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/integrations/api_notification_test.go b/integrations/api_notification_test.go
index baab00f6d2..3296604a08 100644
--- a/integrations/api_notification_test.go
+++ b/integrations/api_notification_test.go
@@ -81,9 +81,15 @@ func TestAPINotification(t *testing.T) {
assert.EqualValues(t, thread5.Issue.APIURL(), apiN.Subject.URL)
assert.EqualValues(t, thread5.Repository.HTMLURL(), apiN.Repository.HTMLURL)
+ new := struct {
+ New int64 `json:"new"`
+ }{}
+
// -- check notifications --
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/notifications/new?token=%s", token))
resp = session.MakeRequest(t, req, http.StatusOK)
+ DecodeJSON(t, resp, &new)
+ assert.True(t, new.New > 0)
// -- mark notifications as read --
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/notifications?token=%s", token))
@@ -110,5 +116,7 @@ func TestAPINotification(t *testing.T) {
// -- check notifications --
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/notifications/new?token=%s", token))
- resp = session.MakeRequest(t, req, http.StatusNoContent)
+ resp = session.MakeRequest(t, req, http.StatusOK)
+ DecodeJSON(t, resp, &new)
+ assert.True(t, new.New == 0)
}