Chore: Add context to org (#40685)

* Add context to org

* Rebase

* Fix rebase
This commit is contained in:
idafurjes
2021-11-03 11:31:56 +01:00
committed by GitHub
parent 91da1bbb79
commit 47f6bb3583
24 changed files with 120 additions and 112 deletions

View File

@ -1,6 +1,7 @@
package utils
import (
"context"
"testing"
"github.com/grafana/grafana/pkg/models"
@ -14,16 +15,16 @@ func TestCheckOrgExists(t *testing.T) {
sqlstore.InitTestDB(t)
defaultOrg := models.CreateOrgCommand{Name: "Main Org."}
err := sqlstore.CreateOrg(&defaultOrg)
err := sqlstore.CreateOrg(context.Background(), &defaultOrg)
require.NoError(t, err)
t.Run("default org exists", func(t *testing.T) {
err := CheckOrgExists(defaultOrg.Result.Id)
err := CheckOrgExists(context.Background(), defaultOrg.Result.Id)
require.NoError(t, err)
})
t.Run("other org doesn't exist", func(t *testing.T) {
err := CheckOrgExists(defaultOrg.Result.Id + 1)
err := CheckOrgExists(context.Background(), defaultOrg.Result.Id+1)
require.Equal(t, err, models.ErrOrgNotFound)
})
})