diff options
author | feistel <6742251-feistel@users.noreply.gitlab.com> | 2021-12-08 16:27:44 +0300 |
---|---|---|
committer | feistel <6742251-feistel@users.noreply.gitlab.com> | 2022-01-14 14:57:39 +0300 |
commit | a5c896d1aa4f672ec46778b9f98c7850a38bc94c (patch) | |
tree | 177f574f9cc782f450983e4b073911448144089a /internal/testhelpers | |
parent | a7e130776d934a12ab000bee930c5c353b772635 (diff) |
test: replace http status assertions with testify method
Diffstat (limited to 'internal/testhelpers')
-rw-r--r-- | internal/testhelpers/testhelpers.go | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/internal/testhelpers/testhelpers.go b/internal/testhelpers/testhelpers.go index bb02b698..11bf7e65 100644 --- a/internal/testhelpers/testhelpers.go +++ b/internal/testhelpers/testhelpers.go @@ -3,7 +3,6 @@ package testhelpers import ( "fmt" "io" - "mime" "net/http" "net/http/httptest" "net/url" @@ -15,22 +14,6 @@ import ( "github.com/stretchr/testify/require" ) -// AssertHTTP404 asserts handler returns 404 with provided str body -func AssertHTTP404(t *testing.T, handler http.HandlerFunc, mode, url string, values url.Values, str interface{}) { - w := httptest.NewRecorder() - req, err := http.NewRequest(mode, url+"?"+values.Encode(), nil) - require.NoError(t, err) - handler(w, req) - - require.Equal(t, http.StatusNotFound, w.Code, "HTTP status") - - if str != nil { - contentType, _, _ := mime.ParseMediaType(w.Header().Get("Content-Type")) - require.Equal(t, "text/html", contentType, "Content-Type") - require.Contains(t, w.Body.String(), str) - } -} - // AssertRedirectTo asserts that handler redirects to particular URL func AssertRedirectTo(t *testing.T, handler http.HandlerFunc, method string, url string, values url.Values, expectedURL string) { |