From a9bd83b4ef6cc3e2da04f057525c670d6b8049f7 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 4 Apr 2015 17:42:19 -0700 Subject: [PATCH] http: fix tests --- api/secret.go | 2 +- http/logical_test.go | 6 ++++-- http/sys_audit_test.go | 2 +- http/sys_auth_test.go | 8 ++++---- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/api/secret.go b/api/secret.go index 93d67bf854..e91d0bb4da 100644 --- a/api/secret.go +++ b/api/secret.go @@ -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"` diff --git a/http/logical_test.go b/http/logical_test.go index 533deed3a9..33dc492b2a 100644 --- a/http/logical_test.go +++ b/http/logical_test.go @@ -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) } } diff --git a/http/sys_audit_test.go b/http/sys_audit_test.go index f3053925bd..2f84c40bec 100644 --- a/http/sys_audit_test.go +++ b/http/sys_audit_test.go @@ -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{}{}, diff --git a/http/sys_auth_test.go b/http/sys_auth_test.go index f031fc3312..22046051d8 100644 --- a/http/sys_auth_test.go +++ b/http/sys_auth_test.go @@ -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", },