diff options
Diffstat (limited to 'internal/gitlabnet')
5 files changed, 15 insertions, 13 deletions
diff --git a/internal/gitlabnet/accessverifier/client_test.go b/internal/gitlabnet/accessverifier/client_test.go index d3f34f6..f617c38 100644 --- a/internal/gitlabnet/accessverifier/client_test.go +++ b/internal/gitlabnet/accessverifier/client_test.go @@ -3,8 +3,9 @@ package accessverifier import ( "context" "encoding/json" - "io/ioutil" + "io" "net/http" + "os" "path" "testing" @@ -165,14 +166,14 @@ func TestErrorResponses(t *testing.T) { func setup(t *testing.T, allowedPayload string) *Client { testhelper.PrepareTestRootDir(t) - body, err := ioutil.ReadFile(path.Join(testhelper.TestRoot, "responses/allowed.json")) + body, err := os.ReadFile(path.Join(testhelper.TestRoot, "responses/allowed.json")) require.NoError(t, err) var bodyWithPayload []byte if allowedPayload != "" { allowedWithPayloadPath := path.Join(testhelper.TestRoot, allowedPayload) - bodyWithPayload, err = ioutil.ReadFile(allowedWithPayloadPath) + bodyWithPayload, err = os.ReadFile(allowedWithPayloadPath) require.NoError(t, err) } @@ -180,7 +181,7 @@ func setup(t *testing.T, allowedPayload string) *Client { { Path: "/api/v4/internal/allowed", Handler: func(w http.ResponseWriter, r *http.Request) { - b, err := ioutil.ReadAll(r.Body) + b, err := io.ReadAll(r.Body) require.NoError(t, err) var requestBody *Request diff --git a/internal/gitlabnet/lfsauthenticate/client_test.go b/internal/gitlabnet/lfsauthenticate/client_test.go index d554cac..c745306 100644 --- a/internal/gitlabnet/lfsauthenticate/client_test.go +++ b/internal/gitlabnet/lfsauthenticate/client_test.go @@ -3,7 +3,7 @@ package lfsauthenticate import ( "context" "encoding/json" - "io/ioutil" + "io" "net/http" "testing" @@ -24,7 +24,7 @@ func setup(t *testing.T) []testserver.TestRequestHandler { { Path: "/api/v4/internal/lfs_authenticate", Handler: func(w http.ResponseWriter, r *http.Request) { - b, err := ioutil.ReadAll(r.Body) + b, err := io.ReadAll(r.Body) defer r.Body.Close() require.NoError(t, err) diff --git a/internal/gitlabnet/personalaccesstoken/client_test.go b/internal/gitlabnet/personalaccesstoken/client_test.go index d67b085..d36cd44 100644 --- a/internal/gitlabnet/personalaccesstoken/client_test.go +++ b/internal/gitlabnet/personalaccesstoken/client_test.go @@ -3,7 +3,7 @@ package personalaccesstoken import ( "context" "encoding/json" - "io/ioutil" + "io" "net/http" "testing" @@ -24,7 +24,7 @@ func initialize(t *testing.T) { { Path: "/api/v4/internal/personal_access_token", Handler: func(w http.ResponseWriter, r *http.Request) { - b, err := ioutil.ReadAll(r.Body) + b, err := io.ReadAll(r.Body) defer r.Body.Close() require.NoError(t, err) diff --git a/internal/gitlabnet/twofactorrecover/client_test.go b/internal/gitlabnet/twofactorrecover/client_test.go index 62f88dc..921c114 100644 --- a/internal/gitlabnet/twofactorrecover/client_test.go +++ b/internal/gitlabnet/twofactorrecover/client_test.go @@ -3,7 +3,7 @@ package twofactorrecover import ( "context" "encoding/json" - "io/ioutil" + "io" "net/http" "testing" @@ -24,7 +24,7 @@ func initialize(t *testing.T) { { Path: "/api/v4/internal/two_factor_recovery_codes", Handler: func(w http.ResponseWriter, r *http.Request) { - b, err := ioutil.ReadAll(r.Body) + b, err := io.ReadAll(r.Body) defer r.Body.Close() require.NoError(t, err) diff --git a/internal/gitlabnet/twofactorverify/client_test.go b/internal/gitlabnet/twofactorverify/client_test.go index 9893b12..e4f837b 100644 --- a/internal/gitlabnet/twofactorverify/client_test.go +++ b/internal/gitlabnet/twofactorverify/client_test.go @@ -3,11 +3,12 @@ package twofactorverify import ( "context" "encoding/json" - "gitlab.com/gitlab-org/gitlab-shell/internal/gitlabnet/discover" - "io/ioutil" + "io" "net/http" "testing" + "gitlab.com/gitlab-org/gitlab-shell/internal/gitlabnet/discover" + "github.com/stretchr/testify/require" "gitlab.com/gitlab-org/gitlab-shell/client" "gitlab.com/gitlab-org/gitlab-shell/client/testserver" @@ -20,7 +21,7 @@ func initialize(t *testing.T) []testserver.TestRequestHandler { { Path: "/api/v4/internal/two_factor_otp_check", Handler: func(w http.ResponseWriter, r *http.Request) { - b, err := ioutil.ReadAll(r.Body) + b, err := io.ReadAll(r.Body) defer r.Body.Close() require.NoError(t, err) |