Replace AddHandler with AddHandlerCtx in tests (#42585)

This commit is contained in:
idafurjes
2021-12-01 15:43:31 +01:00
committed by GitHub
parent 2e3fd9d659
commit e6123bc3ef
37 changed files with 173 additions and 162 deletions
+3 -2
View File
@@ -1,6 +1,7 @@
package api
import (
"context"
"testing"
"github.com/grafana/grafana/pkg/bus"
@@ -45,7 +46,7 @@ func TestTeamAPIEndpoint(t *testing.T) {
loggedInUserScenario(t, "When calling GET on", "/api/teams/search", func(sc *scenarioContext) {
var sentLimit int
var sendPage int
bus.AddHandler("test", func(query *models.SearchTeamsQuery) error {
bus.AddHandlerCtx("test", func(ctx context.Context, query *models.SearchTeamsQuery) error {
query.Result = mockResult
sentLimit = query.Limit
@@ -70,7 +71,7 @@ func TestTeamAPIEndpoint(t *testing.T) {
loggedInUserScenario(t, "When calling GET on", "/api/teams/search", func(sc *scenarioContext) {
var sentLimit int
var sendPage int
bus.AddHandler("test", func(query *models.SearchTeamsQuery) error {
bus.AddHandlerCtx("test", func(ctx context.Context, query *models.SearchTeamsQuery) error {
query.Result = mockResult
sentLimit = query.Limit