package apitest import ( "testing" "git.artlef.fr/PersonalLibraryManager/internal/testutils" "github.com/gin-gonic/gin" "github.com/stretchr/testify/assert" ) func TestGetWantReadBooksHandler_Demo(t *testing.T) { router := testutils.TestSetup() token := testutils.ConnectDemoUser(router) books := testGetWantReadBooksHandler(t, router, token, 200) assert.Equal(t, 2, len(books)) } func TestGetWantReadBooksHandler_Demo2(t *testing.T) { router := testutils.TestSetup() token := testutils.ConnectDemo2User(router) books := testGetWantReadBooksHandler(t, router, token, 200) assert.Equal(t, 0, len(books)) } func testGetWantReadBooksHandler(t *testing.T, router *gin.Engine, userToken string, expectedCode int) []bookUserGet { return testGetbooksHandler(t, router, userToken, expectedCode, "/mybooks/wantread") }