From b7ccd745c8df7017b3d1599ebead5d43645d8a4d Mon Sep 17 00:00:00 2001 From: Arya Khochare <91268931+Aryakoste@users.noreply.github.com> Date: Mon, 14 Oct 2024 15:59:37 +0530 Subject: [PATCH] Fixed errcheck issues in server/channels/api4/oauth_test.go (#28645) Co-authored-by: Ibrahim Serdar Acikgoz --- server/.golangci.yml | 1 - server/channels/api4/oauth_test.go | 24 ++++++++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/server/.golangci.yml b/server/.golangci.yml index 1126d6b936..8e263e351a 100644 --- a/server/.golangci.yml +++ b/server/.golangci.yml @@ -79,7 +79,6 @@ issues: channels/api4/job_test.go|\ channels/api4/license.go|\ channels/api4/license_local.go|\ - channels/api4/oauth_test.go|\ channels/api4/post_test.go|\ channels/api4/preference_test.go|\ channels/api4/reaction_test.go|\ diff --git a/server/channels/api4/oauth_test.go b/server/channels/api4/oauth_test.go index 384f8917d3..ab9b8c7be6 100644 --- a/server/channels/api4/oauth_test.go +++ b/server/channels/api4/oauth_test.go @@ -64,7 +64,8 @@ func TestCreateOAuthApp(t *testing.T) { require.Error(t, err, "expected error from garbage post") assert.Equal(t, http.StatusBadRequest, r.StatusCode) - client.Logout(context.Background()) + _, err = client.Logout(context.Background()) + require.NoError(t, err) _, resp, err = client.CreateOAuthApp(context.Background(), oapp) require.Error(t, err) CheckUnauthorizedStatus(t, resp) @@ -156,7 +157,8 @@ func TestUpdateOAuthApp(t *testing.T) { require.Error(t, err) CheckNotImplementedStatus(t, resp) - client.Logout(context.Background()) + _, err = client.Logout(context.Background()) + require.NoError(t, err) _, resp, err = client.UpdateOAuthApp(context.Background(), oapp) require.Error(t, err) CheckUnauthorizedStatus(t, resp) @@ -255,7 +257,8 @@ func TestGetOAuthApps(t *testing.T) { require.Error(t, err) CheckForbiddenStatus(t, resp) - client.Logout(context.Background()) + _, err = client.Logout(context.Background()) + require.NoError(t, err) _, resp, err = client.GetOAuthApps(context.Background(), 0, 1000) require.Error(t, err) @@ -317,7 +320,8 @@ func TestGetOAuthApp(t *testing.T) { require.Error(t, err) CheckForbiddenStatus(t, resp) - client.Logout(context.Background()) + _, err = client.Logout(context.Background()) + require.NoError(t, err) _, resp, err = client.GetOAuthApp(context.Background(), rapp2.Id) require.Error(t, err) @@ -385,7 +389,8 @@ func TestGetOAuthAppInfo(t *testing.T) { _, _, err = client.GetOAuthAppInfo(context.Background(), rapp2.Id) require.NoError(t, err) - client.Logout(context.Background()) + _, err = client.Logout(context.Background()) + require.NoError(t, err) _, resp, err := client.GetOAuthAppInfo(context.Background(), rapp2.Id) require.Error(t, err) @@ -458,7 +463,8 @@ func TestDeleteOAuthApp(t *testing.T) { require.Error(t, err) CheckForbiddenStatus(t, resp) - client.Logout(context.Background()) + _, err = client.Logout(context.Background()) + require.NoError(t, err) resp, err = client.DeleteOAuthApp(context.Background(), rapp.Id) require.Error(t, err) CheckUnauthorizedStatus(t, resp) @@ -532,7 +538,8 @@ func TestRegenerateOAuthAppSecret(t *testing.T) { require.Error(t, err) CheckForbiddenStatus(t, resp) - client.Logout(context.Background()) + _, err = client.Logout(context.Background()) + require.NoError(t, err) _, resp, err = client.RegenerateOAuthAppSecret(context.Background(), rapp.Id) require.Error(t, err) CheckUnauthorizedStatus(t, resp) @@ -599,7 +606,8 @@ func TestGetAuthorizedOAuthAppsForUser(t *testing.T) { require.Error(t, err) CheckBadRequestStatus(t, resp) - client.Logout(context.Background()) + _, err = client.Logout(context.Background()) + require.NoError(t, err) _, resp, err = client.GetAuthorizedOAuthAppsForUser(context.Background(), th.BasicUser.Id, 0, 1000) require.Error(t, err) CheckUnauthorizedStatus(t, resp)