diff --git a/server/.golangci.yml b/server/.golangci.yml index c8c9ed52c8d..989e49c65ee 100644 --- a/server/.golangci.yml +++ b/server/.golangci.yml @@ -142,7 +142,6 @@ issues: channels/app/slack.go|\ channels/app/slashcommands/auto_environment.go|\ channels/app/slashcommands/command_loadtest.go|\ - channels/app/slashcommands/command_remove_test.go|\ channels/app/slashcommands/command_test.go|\ channels/app/slashcommands/helper_test.go|\ channels/app/status.go|\ diff --git a/server/channels/app/slashcommands/command_remove_test.go b/server/channels/app/slashcommands/command_remove_test.go index 26fb30a25ba..b0dc77ceba6 100644 --- a/server/channels/app/slashcommands/command_remove_test.go +++ b/server/channels/app/slashcommands/command_remove_test.go @@ -7,6 +7,7 @@ import ( "testing" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/mattermost/mattermost/server/public/model" ) @@ -34,9 +35,12 @@ func TestRemoveProviderDoCommand(t *testing.T) { }, false) targetUser := th.createUser() - th.App.AddUserToTeam(th.Context, th.BasicTeam.Id, targetUser.Id, targetUser.Id) - th.App.AddUserToChannel(th.Context, targetUser, publicChannel, false) - th.App.AddUserToChannel(th.Context, targetUser, privateChannel, false) + _, _, err := th.App.AddUserToTeam(th.Context, th.BasicTeam.Id, targetUser.Id, targetUser.Id) + require.Nil(t, err) + _, err = th.App.AddUserToChannel(th.Context, targetUser, publicChannel, false) + require.Nil(t, err) + _, err = th.App.AddUserToChannel(th.Context, targetUser, privateChannel, false) + require.Nil(t, err) // Try a public channel *without* permission. args := &model.CommandArgs{ @@ -49,7 +53,8 @@ func TestRemoveProviderDoCommand(t *testing.T) { assert.Equal(t, "api.command_remove.permission.app_error", actual) // Try a public channel *with* permission. - th.App.AddUserToChannel(th.Context, th.BasicUser, publicChannel, false) + _, err = th.App.AddUserToChannel(th.Context, th.BasicUser, publicChannel, false) + require.Nil(t, err) args = &model.CommandArgs{ T: func(s string, args ...any) string { return s }, ChannelId: publicChannel.Id, @@ -70,7 +75,8 @@ func TestRemoveProviderDoCommand(t *testing.T) { assert.Equal(t, "api.command_remove.permission.app_error", actual) // Try a private channel *with* permission. - th.App.AddUserToChannel(th.Context, th.BasicUser, privateChannel, false) + _, err = th.App.AddUserToChannel(th.Context, th.BasicUser, privateChannel, false) + require.Nil(t, err) args = &model.CommandArgs{ T: func(s string, args ...any) string { return s }, ChannelId: privateChannel.Id, @@ -109,9 +115,12 @@ func TestRemoveProviderDoCommand(t *testing.T) { // Try a public channel with a deactivated user. deactivatedUser := th.createUser() - th.App.AddUserToTeam(th.Context, th.BasicTeam.Id, deactivatedUser.Id, deactivatedUser.Id) - th.App.AddUserToChannel(th.Context, deactivatedUser, publicChannel, false) - th.App.UpdateActive(th.Context, deactivatedUser, false) + _, _, err = th.App.AddUserToTeam(th.Context, th.BasicTeam.Id, deactivatedUser.Id, deactivatedUser.Id) + require.Nil(t, err) + _, err = th.App.AddUserToChannel(th.Context, deactivatedUser, publicChannel, false) + require.Nil(t, err) + _, err = th.App.UpdateActive(th.Context, deactivatedUser, false) + require.Nil(t, err) args = &model.CommandArgs{ T: func(s string, args ...any) string { return s },