pkg/models: Check errors (#19839)

Check errors in pkg/models.
This commit is contained in:
Arve Knudsen 2019-10-22 16:18:36 +02:00 committed by GitHub
parent 8ba5509614
commit 9843a886f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,6 +9,7 @@ import (
"time" "time"
. "github.com/smartystreets/goconvey/convey" . "github.com/smartystreets/goconvey/convey"
"github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/components/simplejson" "github.com/grafana/grafana/pkg/components/simplejson"
"github.com/grafana/grafana/pkg/setting" "github.com/grafana/grafana/pkg/setting"
@ -201,11 +202,14 @@ func TestDataSourceCache(t *testing.T) {
// Can't use So() here, see: https://github.com/smartystreets/goconvey/issues/561 // Can't use So() here, see: https://github.com/smartystreets/goconvey/issues/561
if r.Header.Get("Authorization") == "Bearer xf5yhfkpsnmgo" { if r.Header.Get("Authorization") == "Bearer xf5yhfkpsnmgo" {
w.WriteHeader(200) w.WriteHeader(200)
w.Write([]byte("Ok")) _, err := w.Write([]byte("Ok"))
require.Nil(t, err)
return return
} }
w.WriteHeader(403) w.WriteHeader(403)
w.Write([]byte("Invalid bearer token provided")) _, err := w.Write([]byte("Invalid bearer token provided"))
require.Nil(t, err)
})) }))
defer backend.Close() defer backend.Close()