Add a config to get inventaire.io URL

This commit is contained in:
2026-02-09 00:17:11 +01:00
parent f73defdad3
commit 60c610de42
11 changed files with 52 additions and 50 deletions

View File

@@ -6,8 +6,12 @@ import (
"github.com/stretchr/testify/assert"
)
func getBaseInventaireUrl() string {
return "https://inventaire.io"
}
func TestCallInventaireSearch_NoParameters(t *testing.T) {
result, err := CallInventaireSearch("salammbo", "", 0, 0)
result, err := CallInventaireSearch(getBaseInventaireUrl(), "salammbo", "", 0, 0)
if err != nil {
t.Error(err)
}
@@ -16,7 +20,7 @@ func TestCallInventaireSearch_NoParameters(t *testing.T) {
}
func TestCallInventaireSearch_NoLimit(t *testing.T) {
result, err := CallInventaireSearch("salammbo", "fr", 0, 0)
result, err := CallInventaireSearch(getBaseInventaireUrl(), "salammbo", "fr", 0, 0)
if err != nil {
t.Error(err)
}
@@ -25,7 +29,7 @@ func TestCallInventaireSearch_NoLimit(t *testing.T) {
}
func TestCallInventaireSearch_Limit(t *testing.T) {
result, err := CallInventaireSearch("salammbo", "fr", 5, 0)
result, err := CallInventaireSearch(getBaseInventaireUrl(), "salammbo", "fr", 5, 0)
if err != nil {
t.Error(err)
}
@@ -34,7 +38,7 @@ func TestCallInventaireSearch_Limit(t *testing.T) {
}
func TestCallInventaireSearch_Offset(t *testing.T) {
result, err := CallInventaireSearch("salammbo", "fr", 0, 15)
result, err := CallInventaireSearch(getBaseInventaireUrl(), "salammbo", "fr", 0, 15)
if err != nil {
t.Error(err)
}
@@ -43,7 +47,7 @@ func TestCallInventaireSearch_Offset(t *testing.T) {
}
func TestCallInventaireBook_BraveNewWorld(t *testing.T) {
result, err := callInventaireBook("wd:Q191949", "fr")
result, err := callInventaireBook(getBaseInventaireUrl(), "wd:Q191949", "fr")
if err != nil {
t.Error(err)
}
@@ -55,7 +59,7 @@ func TestCallInventaireBook_BraveNewWorld(t *testing.T) {
}
func TestCallInventaireEditionFromWork_TestLimit(t *testing.T) {
result, err := CallInventaireEditionFromWork("wd:Q339761", "fr", 10, 0)
result, err := CallInventaireEditionFromWork(getBaseInventaireUrl(), "wd:Q339761", "fr", 10, 0)
if err != nil {
t.Error(err)
}
@@ -64,7 +68,7 @@ func TestCallInventaireEditionFromWork_TestLimit(t *testing.T) {
}
func TestCallInventaireEditionFromWork_TestOffset(t *testing.T) {
result, err := CallInventaireEditionFromWork("wd:Q3213142", "fr", 0, 0)
result, err := CallInventaireEditionFromWork(getBaseInventaireUrl(), "wd:Q3213142", "fr", 0, 0)
if err != nil {
t.Error(err)
}
@@ -103,7 +107,7 @@ func TestCallInventaireEditionFromWork_TestOffset(t *testing.T) {
}
func TestCallInventaireEdition(t *testing.T) {
result, err := CallInventaireEdition("isbn:9782266003698", "fr")
result, err := CallInventaireEdition(getBaseInventaireUrl(), "isbn:9782266003698", "fr")
if err != nil {
t.Error(err)
}
@@ -127,7 +131,7 @@ func TestCallInventaireEdition(t *testing.T) {
}
func TestCallInventaireEditionFromISBN(t *testing.T) {
result, err := CallInventaireFromISBN("9782070379248", "fr")
result, err := CallInventaireFromISBN(getBaseInventaireUrl(), "9782070379248", "fr")
if err != nil {
t.Error(err)
}