update command_remove_test.go (fix errcheck issue) (#29177)

Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
Этот коммит содержится в:
TheInvincible
2024-11-13 20:21:49 +01:00
коммит произвёл GitHub
родитель 891b2144df
Коммит 11edef7af0
2 изменённых файлов: 17 добавлений и 9 удалений

Просмотреть файл

@@ -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|\

Просмотреть файл

@@ -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 },