add filter read/want read when browsing books
This commit is contained in:
29
internal/apitest/get_wantread_user_book_test.go
Normal file
29
internal/apitest/get_wantread_user_book_test.go
Normal file
@@ -0,0 +1,29 @@
|
||||
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")
|
||||
}
|
||||
Reference in New Issue
Block a user