Skip to content

Commit

Permalink
iter21: поправил замечания статанализатора
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandr Kosygin committed Jul 14, 2024
1 parent 599e33c commit cbba6ad
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions internal/crypt/cipher_middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

"github.com/golang/mock/gomock"
"github.com/kosalnik/metrics/internal/crypt/mock"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/kosalnik/metrics/internal/crypt"
Expand Down Expand Up @@ -55,10 +56,13 @@ func TestCipherMiddleware(t *testing.T) {
r := httptest.NewRequest(http.MethodPost, `/`, strings.NewReader(tt.encodedBody))
w := httptest.NewRecorder()
h.ServeHTTP(w, r)
res := w.Result()
defer assert.NoError(t, res.Body.Close())
if tt.wantErr {
require.Equal(t, http.StatusBadRequest, w.Result().StatusCode)
require.Equal(t, http.StatusBadRequest, res.StatusCode)

} else {
require.Equal(t, http.StatusOK, w.Result().StatusCode)
require.Equal(t, http.StatusOK, res.StatusCode)
}
})
}
Expand Down

0 comments on commit cbba6ad

Please sign in to comment.