Add a view to see all books in a collection

This commit is contained in:
2026-04-03 22:57:45 +02:00
parent a5c4c0bbec
commit 625d2a2af1
20 changed files with 285 additions and 44 deletions

View File

@@ -68,6 +68,23 @@ func TestBookPutCallWithDemoPayload(t *testing.T, payload string, bookId string,
}
}
func TestFetchOneModel[T any](t *testing.T, urlpath string, id string) (int, T) {
router := TestSetup()
token := ConnectDemoUser(router)
req, _ := http.NewRequest("GET", urlpath+"/"+id, nil)
req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", token))
w := httptest.NewRecorder()
router.ServeHTTP(w, req)
var result T
err := json.Unmarshal(w.Body.Bytes(), &result)
if err != nil {
t.Error(err)
}
return w.Code, result
}
func TestFetchModel[T any](t *testing.T, urlpath string, limit string, offset string) (int, T) {
router := TestSetup()