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
+5 -4
View File
@@ -1,6 +1,7 @@
package api
import (
"context"
"fmt"
"net/http"
"net/http/httptest"
@@ -44,22 +45,22 @@ func TestDashboardSnapshotAPIEndpoint_singleSnapshot(t *testing.T) {
External: true,
}
bus.AddHandler("test", func(query *models.GetDashboardSnapshotQuery) error {
bus.AddHandlerCtx("test", func(ctx context.Context, query *models.GetDashboardSnapshotQuery) error {
query.Result = mockSnapshotResult
return nil
})
bus.AddHandler("test", func(cmd *models.DeleteDashboardSnapshotCommand) error {
bus.AddHandlerCtx("test", func(ctx context.Context, cmd *models.DeleteDashboardSnapshotCommand) error {
return nil
})
bus.AddHandler("test", func(query *models.GetDashboardAclInfoListQuery) error {
bus.AddHandlerCtx("test", func(ctx context.Context, query *models.GetDashboardAclInfoListQuery) error {
query.Result = aclMockResp
return nil
})
teamResp := []*models.TeamDTO{}
bus.AddHandler("test", func(query *models.GetTeamsByUserQuery) error {
bus.AddHandlerCtx("test", func(ctx context.Context, query *models.GetTeamsByUserQuery) error {
query.Result = teamResp
return nil
})