Files
vault/http/sys_policy_test.go
Mitchell Hashimoto 9e7ea8a4ef http: list policies
2015-04-01 17:43:58 -07:00

32 lines
620 B
Go

package http
import (
"net/http"
"reflect"
"testing"
"github.com/hashicorp/vault/vault"
)
func TestSysPolicies(t *testing.T) {
core, _, token := vault.TestCoreUnsealed(t)
ln, addr := TestServer(t, core)
defer ln.Close()
TestServerAuth(t, addr, token)
resp, err := http.Get(addr + "/v1/sys/policy")
if err != nil {
t.Fatalf("err: %s", err)
}
var actual map[string]interface{}
expected := map[string]interface{}{
"policies": []interface{}{"root"},
}
testResponseStatus(t, resp, 200)
testResponseBody(t, resp, &actual)
if !reflect.DeepEqual(actual, expected) {
t.Fatalf("bad: %#v", actual)
}
}