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

View File

@ -1,6 +1,7 @@
package plugins
import (
"context"
"errors"
"testing"
@ -20,7 +21,7 @@ func TestPluginProvisioner(t *testing.T) {
})
t.Run("Should apply configurations", func(t *testing.T) {
bus.AddHandler("test", func(query *models.GetOrgByNameQuery) error {
bus.AddHandlerCtx("test", func(ctx context.Context, query *models.GetOrgByNameQuery) error {
if query.Name == "Org 4" {
query.Result = &models.Org{Id: 4}
}
@ -28,7 +29,7 @@ func TestPluginProvisioner(t *testing.T) {
return nil
})
bus.AddHandler("test", func(query *models.GetPluginSettingByIdQuery) error {
bus.AddHandlerCtx("test", func(ctx context.Context, query *models.GetPluginSettingByIdQuery) error {
if query.PluginId == "test-plugin" && query.OrgId == 2 {
query.Result = &models.PluginSetting{
PluginVersion: "2.0.1",
@ -41,7 +42,7 @@ func TestPluginProvisioner(t *testing.T) {
sentCommands := []*models.UpdatePluginSettingCmd{}
bus.AddHandler("test", func(cmd *models.UpdatePluginSettingCmd) error {
bus.AddHandlerCtx("test", func(ctx context.Context, cmd *models.UpdatePluginSettingCmd) error {
sentCommands = append(sentCommands, cmd)
return nil
})