[MM-61499] Fix errcheck issues in server/channels/app/slashcommands/helper_test.go (#30880)

Этот коммит содержится в:
Ben Schumacher
2025-05-12 11:20:14 +02:00
коммит произвёл GitHub
родитель d452f4f043
Коммит 4dbff921ba
17 изменённых файлов: 248 добавлений и 338 удалений

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

@@ -12,12 +12,11 @@ import (
)
func TestHeaderProviderDoCommand(t *testing.T) {
th := setup(t).initBasic()
defer th.tearDown()
th := setup(t).initBasic(t)
hp := HeaderProvider{}
th.addPermissionToRole(model.PermissionManagePublicChannelProperties.Id, model.ChannelUserRoleId)
th.addPermissionToRole(t, model.PermissionManagePublicChannelProperties.Id, model.ChannelUserRoleId)
// Try a public channel *with* permission.
args := &model.CommandArgs{
@@ -34,7 +33,7 @@ func TestHeaderProviderDoCommand(t *testing.T) {
assert.Equal(t, expected, actual)
}
th.removePermissionFromRole(model.PermissionManagePublicChannelProperties.Id, model.ChannelUserRoleId)
th.removePermissionFromRole(t, model.PermissionManagePublicChannelProperties.Id, model.ChannelUserRoleId)
// Try a public channel *without* permission.
args = &model.CommandArgs{
@@ -46,10 +45,10 @@ func TestHeaderProviderDoCommand(t *testing.T) {
actual := hp.DoCommand(th.App, th.Context, args, "hello").Text
assert.Equal(t, "api.command_channel_header.permission.app_error", actual)
th.addPermissionToRole(model.PermissionManagePrivateChannelProperties.Id, model.ChannelUserRoleId)
th.addPermissionToRole(t, model.PermissionManagePrivateChannelProperties.Id, model.ChannelUserRoleId)
// Try a private channel *with* permission.
privateChannel := th.createPrivateChannel(th.BasicTeam)
privateChannel := th.createPrivateChannel(t, th.BasicTeam)
args = &model.CommandArgs{
T: func(s string, args ...any) string { return s },
@@ -60,7 +59,7 @@ func TestHeaderProviderDoCommand(t *testing.T) {
actual = hp.DoCommand(th.App, th.Context, args, "hello").Text
assert.Equal(t, "", actual)
th.removePermissionFromRole(model.PermissionManagePrivateChannelProperties.Id, model.ChannelUserRoleId)
th.removePermissionFromRole(t, model.PermissionManagePrivateChannelProperties.Id, model.ChannelUserRoleId)
// Try a private channel *without* permission.
args = &model.CommandArgs{
@@ -73,11 +72,11 @@ func TestHeaderProviderDoCommand(t *testing.T) {
assert.Equal(t, "api.command_channel_header.permission.app_error", actual)
// Try a group channel *with* being a member.
user1 := th.createUser()
user2 := th.createUser()
user3 := th.createUser()
user1 := th.createUser(t)
user2 := th.createUser(t)
user3 := th.createUser(t)
groupChannel := th.createGroupChannel(user1, user2)
groupChannel := th.createGroupChannel(t, user1, user2)
args = &model.CommandArgs{
T: func(s string, args ...any) string { return s },
@@ -99,7 +98,7 @@ func TestHeaderProviderDoCommand(t *testing.T) {
assert.Equal(t, "api.command_channel_header.permission.app_error", actual)
// Try a direct channel *with* being a member.
directChannel := th.createDmChannel(user1)
directChannel := th.createDmChannel(t, user1)
args = &model.CommandArgs{
T: func(s string, args ...any) string { return s },