Feat: add more tests

This commit is contained in:
2025-12-07 23:59:24 +08:00
parent 1f313fc17d
commit f191aef810
17 changed files with 307 additions and 25 deletions

View File

@@ -0,0 +1,28 @@
package tests
import (
"net/http"
"strconv"
"testing"
)
func Test_05_GetImages(t *testing.T) {
t.Run("check with alias id", func(t *testing.T) {
resp, err := client.R().
SetQueryParam("aliases", strconv.FormatInt(aliases[0].Id, 10)).
Get("http://localhost:8080/api/images")
if err != nil || resp.StatusCode() != http.StatusOK {
t.Logf("%+v", resp)
t.Fatal("failed to get images by alias id")
}
})
t.Run("check with image id", func(t *testing.T) {
resp, err := client.R().
SetQueryParam("images", strconv.FormatInt(image.Id, 10)).
Get("http://localhost:8080/api/images")
if err != nil || resp.StatusCode() != http.StatusOK {
t.Logf("%+v", resp)
t.Fatal("failed to get images by image id")
}
})
}