JSON API errors
This commit is contained in:
parent
020c058805
commit
7a23779d07
3 changed files with 66 additions and 35 deletions
|
@ -252,6 +252,7 @@ func TestServer_PublishAtWithCacheError(t *testing.T) {
|
|||
"In": "30 min",
|
||||
})
|
||||
require.Equal(t, 400, response.Code)
|
||||
require.Equal(t, errHTTPBadRequestDelayNoCache, toHTTPError(t, response.Body.String()))
|
||||
}
|
||||
|
||||
func TestServer_PublishAtTooShortDelay(t *testing.T) {
|
||||
|
@ -644,6 +645,12 @@ func toMessage(t *testing.T, s string) *message {
|
|||
return &m
|
||||
}
|
||||
|
||||
func toHTTPError(t *testing.T, s string) *errHTTP {
|
||||
var e errHTTP
|
||||
require.Nil(t, json.NewDecoder(strings.NewReader(s)).Decode(&e))
|
||||
return &e
|
||||
}
|
||||
|
||||
func firebaseServiceAccountFile(t *testing.T) string {
|
||||
if os.Getenv("NTFY_TEST_FIREBASE_SERVICE_ACCOUNT_FILE") != "" {
|
||||
return os.Getenv("NTFY_TEST_FIREBASE_SERVICE_ACCOUNT_FILE")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue