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

Function TestResponse_StatusRange

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

Source from the content-addressed store, hash-verified

194}
195
196func TestResponse_StatusRange(t *testing.T) {
197 reporter := newMockReporter(t)
198
199 ranges := []StatusRange{
200 Status1xx,
201 Status2xx,
202 Status3xx,
203 Status4xx,
204 Status5xx,
205 }
206
207 cases := []struct {
208 status int
209 statusRange StatusRange
210 }{
211 {99, StatusRange(-1)},
212 {100, Status1xx},
213 {199, Status1xx},
214 {200, Status2xx},
215 {299, Status2xx},
216 {300, Status3xx},
217 {399, Status3xx},
218 {400, Status4xx},
219 {499, Status4xx},
220 {500, Status5xx},
221 {599, Status5xx},
222 {600, StatusRange(-1)},
223 }
224
225 for _, tc := range cases {
226 for _, r := range ranges {
227 resp := NewResponse(reporter, &http.Response{
228 StatusCode: tc.status,
229 })
230
231 resp.StatusRange(r)
232
233 if tc.statusRange == r {
234 resp.chain.assert(t, success)
235 } else {
236 resp.chain.assert(t, failure)
237 }
238 }
239 }
240}
241
242func TestResponse_StatusList(t *testing.T) {
243 reporter := newMockReporter(t)

Callers

nothing calls this directly

Calls 5

StatusRangeMethod · 0.95
newMockReporterFunction · 0.85
StatusRangeTypeAlias · 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…