MCPcopy Create free account
hub / github.com/gavv/httpexpect / TestResponse_Status

Function TestResponse_Status

response_test.go:168–194  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

166}
167
168func TestResponse_Status(t *testing.T) {
169 reporter := newMockReporter(t)
170
171 cases := []struct {
172 status int
173 testStatus int
174 }{
175 {http.StatusOK, http.StatusOK},
176 {http.StatusOK, http.StatusNotFound},
177 {http.StatusNotFound, http.StatusNotFound},
178 {http.StatusNotFound, http.StatusOK},
179 }
180
181 for _, tc := range cases {
182 resp := NewResponse(reporter, &http.Response{
183 StatusCode: tc.status,
184 })
185
186 resp.Status(tc.testStatus)
187
188 if tc.status == tc.testStatus {
189 resp.chain.assert(t, success)
190 } else {
191 resp.chain.assert(t, failure)
192 }
193 }
194}
195
196func TestResponse_StatusRange(t *testing.T) {
197 reporter := newMockReporter(t)

Callers

nothing calls this directly

Calls 4

StatusMethod · 0.95
newMockReporterFunction · 0.85
NewResponseFunction · 0.85
assertMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…