30 lines
585 B
Go
30 lines
585 B
Go
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")
|
|
}
|
|
}
|