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

Function apiCreateBook

pkg/e2e/sync/testutils.go:171–181  ·  view source on GitHub ↗

apiCreateBook creates a book via the API and returns its UUID

(t *testing.T, env testEnv, user database.User, name, message string)

Source from the content-addressed store, hash-verified

169
170// apiCreateBook creates a book via the API and returns its UUID
171func 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
184func apiPatchBook(t *testing.T, env testEnv, user database.User, uuid, payload, message string) {

Callers 7

TestSync_EmptyServerFunction · 0.85
TestSync_onewayFunction · 0.85
TestSync_twowayFunction · 0.85
TestSyncFunction · 0.85
TestFullSyncFunction · 0.85

Calls 1

doHTTPReqFunction · 0.85

Tested by 7

TestSync_EmptyServerFunction · 0.68
TestSync_onewayFunction · 0.68
TestSync_twowayFunction · 0.68
TestSyncFunction · 0.68
TestFullSyncFunction · 0.68