MCPcopy Index your code
hub / github.com/dnote/dnote / StatusCodeEquals

Function StatusCodeEquals

pkg/assert/assert.go:136–145  ·  view source on GitHub ↗

StatusCodeEquals asserts that the reponse's status code is equal to the expected

(t *testing.T, res *http.Response, expected int, message string)

Source from the content-addressed store, hash-verified

134// StatusCodeEquals asserts that the reponse's status code is equal to the
135// expected
136func StatusCodeEquals(t *testing.T, res *http.Response, expected int, message string) {
137 if res.StatusCode != expected {
138 body, err := io.ReadAll(res.Body)
139 if err != nil {
140 t.Fatal(errors.Wrap(err, "reading body"))
141 }
142
143 t.Errorf("status code mismatch. %s: got %v want %v. Message was: '%s'", message, res.StatusCode, expected, string(body))
144 }
145}

Callers 15

TestGetNotesFunction · 0.92
TestGetNoteFunction · 0.92
TestCreateNoteFunction · 0.92
TestDeleteNoteFunction · 0.92
TestUpdateNoteFunction · 0.92
TestGetBooksFunction · 0.92
TestGetBooksByNameFunction · 0.92
TestGetBookFunction · 0.92
TestGetBookNonOwnerFunction · 0.92
TestCreateBookFunction · 0.92
TestUpdateBookFunction · 0.92
TestDeleteBookFunction · 0.92

Calls

no outgoing calls

Tested by 15

TestGetNotesFunction · 0.74
TestGetNoteFunction · 0.74
TestCreateNoteFunction · 0.74
TestDeleteNoteFunction · 0.74
TestUpdateNoteFunction · 0.74
TestGetBooksFunction · 0.74
TestGetBooksByNameFunction · 0.74
TestGetBookFunction · 0.74
TestGetBookNonOwnerFunction · 0.74
TestCreateBookFunction · 0.74
TestUpdateBookFunction · 0.74
TestDeleteBookFunction · 0.74