Fixed errcheck isssues in Auto_responder_test.go (#28987)

Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
Этот коммит содержится в:
Niharika Goulikar
2024-11-08 13:24:03 +05:30
коммит произвёл GitHub
родитель faa6853a28
Коммит f377399c4c
2 изменённых файлов: 27 добавлений и 10 удалений

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

@@ -83,7 +83,6 @@ issues:
channels/api4/team_test.go|\
channels/api4/user_test.go|\
channels/api4/websocket_test.go|\
channels/app/auto_responder_test.go|\
channels/app/bot_test.go|\
channels/app/brand.go|\
channels/app/channel.go|\

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

@@ -18,7 +18,10 @@ func TestSetAutoResponderStatus(t *testing.T) {
defer th.TearDown()
user := th.CreateUser()
defer th.App.PermanentDeleteUser(th.Context, user)
defer func() {
err := th.App.PermanentDeleteUser(th.Context, user)
require.Nil(t, err)
}()
th.App.SetStatusOnline(user.Id, true)
@@ -56,7 +59,10 @@ func TestDisableAutoResponder(t *testing.T) {
defer th.TearDown()
user := th.CreateUser()
defer th.App.PermanentDeleteUser(th.Context, user)
defer func() {
err := th.App.PermanentDeleteUser(th.Context, user)
require.Nil(t, err)
}()
th.App.SetStatusOnline(user.Id, true)
@@ -65,17 +71,20 @@ func TestDisableAutoResponder(t *testing.T) {
patch.NotifyProps["auto_responder_active"] = "true"
patch.NotifyProps["auto_responder_message"] = "Hello, I'm unavailable today."
th.App.PatchUser(th.Context, user.Id, patch, true)
user, appErr := th.App.PatchUser(th.Context, user.Id, patch, true)
require.Nil(t, appErr)
th.App.DisableAutoResponder(th.Context, user.Id, true)
err := th.App.DisableAutoResponder(th.Context, user.Id, true)
require.Nil(t, err)
userUpdated1, err := th.App.GetUser(user.Id)
require.Nil(t, err)
assert.Equal(t, userUpdated1.NotifyProps["auto_responder_active"], "false")
th.App.DisableAutoResponder(th.Context, user.Id, true)
err = th.App.DisableAutoResponder(th.Context, user.Id, true)
require.Nil(t, err)
userUpdated2, err := th.App.GetUser(user.Id)
require.Nil(t, err)
assert.Equal(t, userUpdated2.NotifyProps["auto_responder_active"], "false")
}
@@ -244,7 +253,10 @@ func TestSendAutoResponseSuccess(t *testing.T) {
defer th.TearDown()
user := th.CreateUser()
defer th.App.PermanentDeleteUser(th.Context, user)
defer func() {
err := th.App.PermanentDeleteUser(th.Context, user)
require.Nil(t, err)
}()
patch := &model.UserPatch{}
patch.NotifyProps = make(map[string]string)
@@ -284,7 +296,10 @@ func TestSendAutoResponseSuccessOnThread(t *testing.T) {
defer th.TearDown()
user := th.CreateUser()
defer th.App.PermanentDeleteUser(th.Context, user)
defer func() {
err := th.App.PermanentDeleteUser(th.Context, user)
require.Nil(t, err)
}()
patch := &model.UserPatch{}
patch.NotifyProps = make(map[string]string)
@@ -333,7 +348,10 @@ func TestSendAutoResponseFailure(t *testing.T) {
defer th.TearDown()
user := th.CreateUser()
defer th.App.PermanentDeleteUser(th.Context, user)
defer func() {
err := th.App.PermanentDeleteUser(th.Context, user)
require.Nil(t, err)
}()
patch := &model.UserPatch{}
patch.NotifyProps = make(map[string]string)