diff options
Diffstat (limited to 'tests/integration/integration_test.go')
-rw-r--r-- | tests/integration/integration_test.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/integration/integration_test.go b/tests/integration/integration_test.go index 2f6b7eae31..5896a97ef1 100644 --- a/tests/integration/integration_test.go +++ b/tests/integration/integration_test.go @@ -1,7 +1,7 @@ // Copyright 2017 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -//nolint:forbidigo +//nolint:forbidigo // use of print functions is allowed in tests package integration import ( @@ -148,6 +148,9 @@ func (s *TestSession) GetCookieFlashMessage() *middleware.Flash { func (s *TestSession) MakeRequest(t testing.TB, rw *RequestWrapper, expectedStatus int) *httptest.ResponseRecorder { t.Helper() + if s == nil { + return MakeRequest(t, rw, expectedStatus) + } req := rw.Request baseURL, err := url.Parse(setting.AppURL) assert.NoError(t, err) @@ -310,7 +313,7 @@ func NewRequestWithValues(t testing.TB, method, urlStr string, values map[string func NewRequestWithURLValues(t testing.TB, method, urlStr string, urlValues url.Values) *RequestWrapper { t.Helper() - return NewRequestWithBody(t, method, urlStr, bytes.NewBufferString(urlValues.Encode())). + return NewRequestWithBody(t, method, urlStr, strings.NewReader(urlValues.Encode())). SetHeader("Content-Type", "application/x-www-form-urlencoded") } @@ -360,7 +363,7 @@ func MakeRequestNilResponseRecorder(t testing.TB, rw *RequestWrapper, expectedSt recorder := NewNilResponseRecorder() testWebRoutes.ServeHTTP(recorder, req) if expectedStatus != NoExpectedStatus { - if !assert.EqualValues(t, expectedStatus, recorder.Code, + if !assert.Equal(t, expectedStatus, recorder.Code, "Request: %s %s", req.Method, req.URL.String()) { logUnexpectedResponse(t, &recorder.ResponseRecorder) } @@ -374,7 +377,7 @@ func MakeRequestNilResponseHashSumRecorder(t testing.TB, rw *RequestWrapper, exp recorder := NewNilResponseHashSumRecorder() testWebRoutes.ServeHTTP(recorder, req) if expectedStatus != NoExpectedStatus { - if !assert.EqualValues(t, expectedStatus, recorder.Code, + if !assert.Equal(t, expectedStatus, recorder.Code, "Request: %s %s", req.Method, req.URL.String()) { logUnexpectedResponse(t, &recorder.ResponseRecorder) } |