Use the same widget for books everywhere
This commit is contained in:
@@ -15,7 +15,7 @@ import (
|
||||
func TestGetBook_Ok(t *testing.T) {
|
||||
book := testGetBook(t, "3", http.StatusOK)
|
||||
assert.Equal(t,
|
||||
dto.BookGet{
|
||||
dto.FullBookGet{
|
||||
Title: "D'un château l'autre",
|
||||
Author: "Louis-Ferdinand Céline",
|
||||
AuthorID: 2,
|
||||
@@ -29,7 +29,7 @@ func TestGetBook_Ok(t *testing.T) {
|
||||
func TestGetBook_NoUserBook(t *testing.T) {
|
||||
book := testGetBook(t, "18", http.StatusOK)
|
||||
assert.Equal(t,
|
||||
dto.BookGet{
|
||||
dto.FullBookGet{
|
||||
Title: "De sang-froid",
|
||||
Author: "Truman Capote",
|
||||
AuthorID: 14,
|
||||
@@ -41,7 +41,7 @@ func TestGetBook_NoUserBook(t *testing.T) {
|
||||
func TestGetBook_Description(t *testing.T) {
|
||||
book := testGetBook(t, "22", http.StatusOK)
|
||||
assert.Equal(t,
|
||||
dto.BookGet{
|
||||
dto.FullBookGet{
|
||||
Title: "Le complot contre l'Amérique",
|
||||
Author: "Philip Roth",
|
||||
AuthorID: 17,
|
||||
@@ -61,7 +61,7 @@ func TestGetBook_IdNotInt(t *testing.T) {
|
||||
testGetBook(t, "wrong", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
func testGetBook(t *testing.T, id string, status int) dto.BookGet {
|
||||
func testGetBook(t *testing.T, id string, status int) dto.FullBookGet {
|
||||
router := testutils.TestSetup()
|
||||
|
||||
token := testutils.ConnectDemoUser(router)
|
||||
@@ -70,7 +70,7 @@ func testGetBook(t *testing.T, id string, status int) dto.BookGet {
|
||||
w := httptest.NewRecorder()
|
||||
router.ServeHTTP(w, req)
|
||||
|
||||
var book dto.BookGet
|
||||
var book dto.FullBookGet
|
||||
err := json.Unmarshal(w.Body.Bytes(), &book)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
|
||||
Reference in New Issue
Block a user