Feat: add more tests
This commit is contained in:
26
tests/04_getAliases_test.go
Normal file
26
tests/04_getAliases_test.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package tests
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"testing"
|
||||
)
|
||||
|
||||
type aliasPayload struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
var aliases []aliasPayload
|
||||
|
||||
func Test_04_GetAliases(t *testing.T) {
|
||||
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("no aliases")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user