mirror of
https://github.com/grafana/grafana.git
synced 2025-07-31 05:02:35 +08:00
Chore: Add context to org (#40685)
* Add context to org * Rebase * Fix rebase
This commit is contained in:
@ -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)
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user