mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-30 18:17:55 +00:00
http: fix tests
This commit is contained in:
@@ -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"`
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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{}{},
|
||||
|
||||
@@ -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",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user