fix: status test errcheck issues (#28541)

Co-authored-by: Mattermost Build <build@mattermost.com>
This commit is contained in:
Rohan Sharma 2024-10-09 18:21:19 +05:30 committed by GitHub
parent 90ceb4a5e3
commit 02e6851603
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 6 deletions

View File

@ -90,7 +90,7 @@ issues:
channels/api4/scheme_test.go|\
channels/api4/shared_channel.go|\
channels/api4/status.go|\
channels/api4/status_test.go|\
channels/api4/system.go|\
channels/api4/system_local.go|\
channels/api4/system_test.go|\
channels/api4/team_local.go|\

View File

@ -85,7 +85,8 @@ func TestGetUserStatus(t *testing.T) {
})
t.Run("get status from logged out user", func(t *testing.T) {
client.Logout(context.Background())
_, err := client.Logout(context.Background())
require.NoError(t, err)
_, resp, err := client.GetUserStatus(context.Background(), th.BasicUser2.Id, "")
require.Error(t, err)
CheckUnauthorizedStatus(t, resp)
@ -173,7 +174,8 @@ func TestGetUsersStatusesByIds(t *testing.T) {
})
t.Run("get statuses from logged out user", func(t *testing.T) {
client.Logout(context.Background())
_, err := client.Logout(context.Background())
require.NoError(t, err)
_, resp, err := client.GetUsersStatusesByIds(context.Background(), usersIds)
require.Error(t, err)
@ -236,7 +238,8 @@ func TestUpdateUserStatus(t *testing.T) {
t.Run("get statuses from logged out user", func(t *testing.T) {
toUpdateUserStatus := &model.Status{Status: "online", UserId: th.BasicUser2.Id}
client.Logout(context.Background())
_, err := client.Logout(context.Background())
require.NoError(t, err)
_, resp, err := client.UpdateUserStatus(context.Background(), th.BasicUser2.Id, toUpdateUserStatus)
require.Error(t, err)
@ -334,7 +337,8 @@ func TestUpdateUserCustomStatus(t *testing.T) {
})
t.Run("attempt to set custom status as non-authenticated user", func(t *testing.T) {
client.Logout(context.Background())
_, err := client.Logout(context.Background())
require.NoError(t, err)
toUpdateCustomStatus := &model.CustomStatus{
Emoji: "palm_tree",
Text: "My custom status",
@ -384,7 +388,8 @@ func TestRemoveUserCustomStatus(t *testing.T) {
})
t.Run("attempt to remove custom status as non-authenticated user", func(t *testing.T) {
client.Logout(context.Background())
_, err := client.Logout(context.Background())
require.NoError(t, err)
resp, err := client.RemoveUserCustomStatus(context.Background(), th.BasicUser.Id)
require.Error(t, err)
CheckUnauthorizedStatus(t, resp)