mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-31 10:37:56 +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. | // Secret is the structure returned for every secret within Vault. | ||||||
| type Secret struct { | type Secret struct { | ||||||
| 	VaultId       string                 `json:"vault_id"` | 	VaultId       string                 `json:"vault_id"` | ||||||
| 	Renewable     bool                   `json":renewable"` | 	Renewable     bool                   `json:"renewable"` | ||||||
| 	LeaseDuration int                    `json:"lease_duration"` | 	LeaseDuration int                    `json:"lease_duration"` | ||||||
| 	Data          map[string]interface{} `json:"data"` | 	Data          map[string]interface{} `json:"data"` | ||||||
| 	Auth          *SecretAuth            `json:"auth,omitempty"` | 	Auth          *SecretAuth            `json:"auth,omitempty"` | ||||||
|   | |||||||
| @@ -4,6 +4,7 @@ import ( | |||||||
| 	"net/http" | 	"net/http" | ||||||
| 	"reflect" | 	"reflect" | ||||||
| 	"testing" | 	"testing" | ||||||
|  | 	"time" | ||||||
|  |  | ||||||
| 	"github.com/hashicorp/vault/vault" | 	"github.com/hashicorp/vault/vault" | ||||||
| ) | ) | ||||||
| @@ -27,16 +28,17 @@ func TestLogical(t *testing.T) { | |||||||
| 	var actual map[string]interface{} | 	var actual map[string]interface{} | ||||||
| 	expected := map[string]interface{}{ | 	expected := map[string]interface{}{ | ||||||
| 		"renewable":      false, | 		"renewable":      false, | ||||||
| 		"lease_duration": float64(0), | 		"lease_duration": float64((30 * 24 * time.Hour) / time.Second), | ||||||
| 		"data": map[string]interface{}{ | 		"data": map[string]interface{}{ | ||||||
| 			"data": "bar", | 			"data": "bar", | ||||||
| 		}, | 		}, | ||||||
|  | 		"auth": nil, | ||||||
| 	} | 	} | ||||||
| 	testResponseStatus(t, resp, 200) | 	testResponseStatus(t, resp, 200) | ||||||
| 	testResponseBody(t, resp, &actual) | 	testResponseBody(t, resp, &actual) | ||||||
| 	delete(actual, "vault_id") | 	delete(actual, "vault_id") | ||||||
| 	if !reflect.DeepEqual(actual, expected) { | 	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{} | 	var actual map[string]interface{} | ||||||
| 	expected := map[string]interface{}{ | 	expected := map[string]interface{}{ | ||||||
| 		"noop": map[string]interface{}{ | 		"noop/": map[string]interface{}{ | ||||||
| 			"type":        "noop", | 			"type":        "noop", | ||||||
| 			"description": "", | 			"description": "", | ||||||
| 			"options":     map[string]interface{}{}, | 			"options":     map[string]interface{}{}, | ||||||
|   | |||||||
| @@ -21,7 +21,7 @@ func TestSysAuth(t *testing.T) { | |||||||
|  |  | ||||||
| 	var actual map[string]interface{} | 	var actual map[string]interface{} | ||||||
| 	expected := map[string]interface{}{ | 	expected := map[string]interface{}{ | ||||||
| 		"token": map[string]interface{}{ | 		"token/": map[string]interface{}{ | ||||||
| 			"description": "token based credentials", | 			"description": "token based credentials", | ||||||
| 			"type":        "token", | 			"type":        "token", | ||||||
| 		}, | 		}, | ||||||
| @@ -52,11 +52,11 @@ func TestSysEnableAuth(t *testing.T) { | |||||||
|  |  | ||||||
| 	var actual map[string]interface{} | 	var actual map[string]interface{} | ||||||
| 	expected := map[string]interface{}{ | 	expected := map[string]interface{}{ | ||||||
| 		"foo": map[string]interface{}{ | 		"foo/": map[string]interface{}{ | ||||||
| 			"description": "foo", | 			"description": "foo", | ||||||
| 			"type":        "noop", | 			"type":        "noop", | ||||||
| 		}, | 		}, | ||||||
| 		"token": map[string]interface{}{ | 		"token/": map[string]interface{}{ | ||||||
| 			"description": "token based credentials", | 			"description": "token based credentials", | ||||||
| 			"type":        "token", | 			"type":        "token", | ||||||
| 		}, | 		}, | ||||||
| @@ -90,7 +90,7 @@ func TestSysDisableAuth(t *testing.T) { | |||||||
|  |  | ||||||
| 	var actual map[string]interface{} | 	var actual map[string]interface{} | ||||||
| 	expected := map[string]interface{}{ | 	expected := map[string]interface{}{ | ||||||
| 		"token": map[string]interface{}{ | 		"token/": map[string]interface{}{ | ||||||
| 			"description": "token based credentials", | 			"description": "token based credentials", | ||||||
| 			"type":        "token", | 			"type":        "token", | ||||||
| 		}, | 		}, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Mitchell Hashimoto
					Mitchell Hashimoto