Fixed errcheck issues in server/channels/api4/oauth_test.go (#28645)

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
Этот коммит содержится в:
Arya Khochare
2024-10-14 15:59:37 +05:30
коммит произвёл GitHub
родитель 6818e0cafa
Коммит b7ccd745c8
2 изменённых файлов: 16 добавлений и 9 удалений

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

@@ -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|\

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

@@ -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)