Switch from open library API to Inventaire API
This commit is contained in:
@@ -18,19 +18,19 @@ type hasId struct {
|
||||
}
|
||||
|
||||
func TestPostImportBookHandler_Ok(t *testing.T) {
|
||||
id := testPostImportBookHandler(t, "OL21177W", http.StatusOK)
|
||||
id := testPostImportBookHandler(t, "Q202975", http.StatusOK)
|
||||
book := testGetBook(t, strconv.FormatUint(uint64(id), 10), 200)
|
||||
assert.Equal(t, "Wuthering Heights", book.Title)
|
||||
assert.Equal(t, "Emily Brontë", book.Author)
|
||||
assert.Equal(t, "OL21177W", book.OpenLibraryId)
|
||||
assert.Equal(t, "Les Hauts de Hurlevent", book.Title)
|
||||
assert.Equal(t, "Emily Brontë", book.Author)
|
||||
assert.Equal(t, "Q202975", book.InventaireID)
|
||||
}
|
||||
|
||||
func TestPostImportBookHandler_OkAuthorKey(t *testing.T) {
|
||||
id := testPostImportBookHandler(t, "OL7525169M", http.StatusOK)
|
||||
id := testPostImportBookHandler(t, "Q1317915", http.StatusOK)
|
||||
book := testGetBook(t, strconv.FormatUint(uint64(id), 10), 200)
|
||||
assert.Equal(t, "Dr. Bloodmoney, or How We Got Along After the Bomb", book.Title)
|
||||
assert.Equal(t, "Dr Bloodmoney", book.Title)
|
||||
assert.Equal(t, "Philip K. Dick", book.Author)
|
||||
assert.Equal(t, "OL7525169M", book.OpenLibraryId)
|
||||
assert.Equal(t, "Q1317915", book.InventaireID)
|
||||
}
|
||||
|
||||
func TestPostImportBookHandler_NoOLID(t *testing.T) {
|
||||
@@ -43,7 +43,8 @@ func testPostImportBookHandler(t *testing.T, openlibraryid string, expectedCode
|
||||
|
||||
token := testutils.ConnectDemoUser(router)
|
||||
queryJson := `{
|
||||
"openlibraryid":"%s"
|
||||
"inventaireid":"%s",
|
||||
"lang":"fr"
|
||||
}`
|
||||
queryJson = fmt.Sprintf(queryJson, openlibraryid)
|
||||
req, _ := http.NewRequest("POST", "/importbook",
|
||||
|
||||
Reference in New Issue
Block a user