MCPcopy
hub / github.com/stretchr/testify / TestHTTPStatusesWrapper

Function TestHTTPStatusesWrapper

assert/http_assertions_test.go:141–158  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

139}
140
141func TestHTTPStatusesWrapper(t *testing.T) {
142 t.Parallel()
143
144 assert := New(t)
145 mockAssert := New(new(testing.T))
146
147 assert.Equal(mockAssert.HTTPSuccess(httpOK, "GET", "/", nil), true)
148 assert.Equal(mockAssert.HTTPSuccess(httpRedirect, "GET", "/", nil), false)
149 assert.Equal(mockAssert.HTTPSuccess(httpError, "GET", "/", nil), false)
150
151 assert.Equal(mockAssert.HTTPRedirect(httpOK, "GET", "/", nil), false)
152 assert.Equal(mockAssert.HTTPRedirect(httpRedirect, "GET", "/", nil), true)
153 assert.Equal(mockAssert.HTTPRedirect(httpError, "GET", "/", nil), false)
154
155 assert.Equal(mockAssert.HTTPError(httpOK, "GET", "/", nil), false)
156 assert.Equal(mockAssert.HTTPError(httpRedirect, "GET", "/", nil), false)
157 assert.Equal(mockAssert.HTTPError(httpError, "GET", "/", nil), true)
158}
159
160func httpHelloName(w http.ResponseWriter, r *http.Request) {
161 name := r.FormValue("name")

Callers

nothing calls this directly

Calls 5

NewFunction · 0.70
EqualMethod · 0.45
HTTPSuccessMethod · 0.45
HTTPRedirectMethod · 0.45
HTTPErrorMethod · 0.45

Tested by

no test coverage detected