[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 удалений

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

@@ -27,10 +27,9 @@ func setupForSharedChannels(tb testing.TB) *TestHelper {
func TestShareProviderDoCommand(t *testing.T) {
t.Run("share command sends a websocket channel updated event", func(t *testing.T) {
th := setupForSharedChannels(t).initBasic()
defer th.tearDown()
th := setupForSharedChannels(t).initBasic(t)
th.addPermissionToRole(model.PermissionManageSharedChannels.Id, th.BasicUser.Roles)
th.addPermissionToRole(t, model.PermissionManageSharedChannels.Id, th.BasicUser.Roles)
mockSyncService := app.NewMockSharedChannelService(th.Server.GetSharedChannelSyncService())
th.Server.SetSharedChannelSyncService(mockSyncService)
@@ -39,7 +38,7 @@ func TestShareProviderDoCommand(t *testing.T) {
th.Server.Platform().SetCluster(testCluster)
commandProvider := ShareProvider{}
channel := th.CreateChannel(th.BasicTeam, WithShared(false))
channel := th.CreateChannel(t, th.BasicTeam, WithShared(false))
args := &model.CommandArgs{
T: func(s string, args ...any) string { return s },
@@ -60,10 +59,9 @@ func TestShareProviderDoCommand(t *testing.T) {
})
t.Run("unshare command sends a websocket channel updated event", func(t *testing.T) {
th := setupForSharedChannels(t).initBasic()
defer th.tearDown()
th := setupForSharedChannels(t).initBasic(t)
th.addPermissionToRole(model.PermissionManageSharedChannels.Id, th.BasicUser.Roles)
th.addPermissionToRole(t, model.PermissionManageSharedChannels.Id, th.BasicUser.Roles)
mockSyncService := app.NewMockSharedChannelService(th.Server.GetSharedChannelSyncService())
th.Server.SetSharedChannelSyncService(mockSyncService)
@@ -72,7 +70,7 @@ func TestShareProviderDoCommand(t *testing.T) {
th.Server.Platform().SetCluster(testCluster)
commandProvider := ShareProvider{}
channel := th.CreateChannel(th.BasicTeam, WithShared(true))
channel := th.CreateChannel(t, th.BasicTeam, WithShared(true))
args := &model.CommandArgs{
T: func(s string, args ...any) string { return s },
ChannelId: channel.Id,
@@ -92,10 +90,9 @@ func TestShareProviderDoCommand(t *testing.T) {
})
t.Run("invite remote to channel shared with us", func(t *testing.T) {
th := setupForSharedChannels(t).initBasic()
defer th.tearDown()
th := setupForSharedChannels(t).initBasic(t)
th.addPermissionToRole(model.PermissionManageSharedChannels.Id, th.BasicUser.Roles)
th.addPermissionToRole(t, model.PermissionManageSharedChannels.Id, th.BasicUser.Roles)
mockSyncService := app.NewMockSharedChannelService(th.Server.GetSharedChannelSyncService())
th.Server.SetSharedChannelSyncService(mockSyncService)
@@ -116,7 +113,7 @@ func TestShareProviderDoCommand(t *testing.T) {
require.Nil(t, err)
commandProvider := ShareProvider{}
channel := th.CreateChannel(th.BasicTeam, WithShared(true)) // will create with generated remoteID
channel := th.CreateChannel(t, th.BasicTeam, WithShared(true)) // will create with generated remoteID
args := &model.CommandArgs{
T: func(s string, args ...any) string { return s },
ChannelId: channel.Id,