mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Added a sql integration test for api keys
This commit is contained in:
parent
57dc12ee17
commit
a88187023d
31
pkg/services/sqlstore/apikey_test.go
Normal file
31
pkg/services/sqlstore/apikey_test.go
Normal file
@ -0,0 +1,31 @@
|
||||
package sqlstore
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
|
||||
m "github.com/grafana/grafana/pkg/models"
|
||||
)
|
||||
|
||||
func TestApiKeyDataAccess(t *testing.T) {
|
||||
|
||||
Convey("Testing API Key data access", t, func() {
|
||||
InitTestDB(t)
|
||||
|
||||
Convey("Given saved api key", func() {
|
||||
cmd := m.AddApiKeyCommand{AccountId: 1, Key: "hello"}
|
||||
err := AddApiKey(&cmd)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
Convey("Should be able to get key by key", func() {
|
||||
query := m.GetApiKeyByKeyQuery{Key: "hello"}
|
||||
err = GetApiKeyByKey(&query)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
So(query.Result, ShouldNotBeNil)
|
||||
})
|
||||
|
||||
})
|
||||
})
|
||||
}
|
Loading…
Reference in New Issue
Block a user