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,29 @@
package tests
import (
"fmt"
"net/http"
"testing"
)
func Test_07_DeleteAlias(t *testing.T) {
resp, err := client.R().
Delete(fmt.Sprintf("http://localhost:8080/api/alias/%d",
aliases[0].Id))
if err != nil || resp.StatusCode() != http.StatusOK {
t.Logf("%+v", resp)
t.Fatal("failed to delete alias")
}
resp, err = client.R().
SetResult(&aliases).
Get("http://localhost:8080/api/aliases")
if err != nil || resp.StatusCode() != http.StatusOK {
t.Logf("%+v", resp)
t.Fatal("failed to get aliases")
}
if len(aliases) > 0 {
t.Fatal("alias not deleted")
}
}