http: fix tests

This commit is contained in:
Mitchell Hashimoto
2015-04-04 17:42:19 -07:00
parent 7ac32b5da5
commit a9bd83b4ef
4 changed files with 10 additions and 8 deletions

View File

@@ -8,7 +8,7 @@ import (
// Secret is the structure returned for every secret within Vault.
type Secret struct {
VaultId string `json:"vault_id"`
Renewable bool `json":renewable"`
Renewable bool `json:"renewable"`
LeaseDuration int `json:"lease_duration"`
Data map[string]interface{} `json:"data"`
Auth *SecretAuth `json:"auth,omitempty"`

View File

@@ -4,6 +4,7 @@ import (
"net/http"
"reflect"
"testing"
"time"
"github.com/hashicorp/vault/vault"
)
@@ -27,16 +28,17 @@ func TestLogical(t *testing.T) {
var actual map[string]interface{}
expected := map[string]interface{}{
"renewable": false,
"lease_duration": float64(0),
"lease_duration": float64((30 * 24 * time.Hour) / time.Second),
"data": map[string]interface{}{
"data": "bar",
},
"auth": nil,
}
testResponseStatus(t, resp, 200)
testResponseBody(t, resp, &actual)
delete(actual, "vault_id")
if !reflect.DeepEqual(actual, expected) {
t.Fatalf("bad: %#v", actual)
t.Fatalf("bad: %#v %#v", actual, expected)
}
}

View File

@@ -26,7 +26,7 @@ func TestSysAudit(t *testing.T) {
var actual map[string]interface{}
expected := map[string]interface{}{
"noop": map[string]interface{}{
"noop/": map[string]interface{}{
"type": "noop",
"description": "",
"options": map[string]interface{}{},

View File

@@ -21,7 +21,7 @@ func TestSysAuth(t *testing.T) {
var actual map[string]interface{}
expected := map[string]interface{}{
"token": map[string]interface{}{
"token/": map[string]interface{}{
"description": "token based credentials",
"type": "token",
},
@@ -52,11 +52,11 @@ func TestSysEnableAuth(t *testing.T) {
var actual map[string]interface{}
expected := map[string]interface{}{
"foo": map[string]interface{}{
"foo/": map[string]interface{}{
"description": "foo",
"type": "noop",
},
"token": map[string]interface{}{
"token/": map[string]interface{}{
"description": "token based credentials",
"type": "token",
},
@@ -90,7 +90,7 @@ func TestSysDisableAuth(t *testing.T) {
var actual map[string]interface{}
expected := map[string]interface{}{
"token": map[string]interface{}{
"token/": map[string]interface{}{
"description": "token based credentials",
"type": "token",
},