apiCreateBook creates a book via the API and returns its UUID
(t *testing.T, env testEnv, user database.User, name, message string)
| 169 | |
| 170 | // apiCreateBook creates a book via the API and returns its UUID |
| 171 | func apiCreateBook(t *testing.T, env testEnv, user database.User, name, message string) string { |
| 172 | res := doHTTPReq(t, env, "POST", "/v3/books", fmt.Sprintf(`{"name": "%s"}`, name), message, user) |
| 173 | |
| 174 | var resp controllers.CreateBookResp |
| 175 | if err := json.NewDecoder(res.Body).Decode(&resp); err != nil { |
| 176 | t.Fatal(errors.Wrap(err, "decoding payload for adding book")) |
| 177 | return "" |
| 178 | } |
| 179 | |
| 180 | return resp.Book.UUID |
| 181 | } |
| 182 | |
| 183 | // apiPatchBook updates a book via the API |
| 184 | func apiPatchBook(t *testing.T, env testEnv, user database.User, uuid, payload, message string) { |