Feat: add more tests
This commit is contained in:
29
tests/07_deleteAlias_test.go
Normal file
29
tests/07_deleteAlias_test.go
Normal 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")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user