Skip to content

Commit

Permalink
Add field read test
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalnayak committed Apr 24, 2018
1 parent 0962457 commit 33256ab
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions builtin/credential/approle/path_role_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,39 @@ import (
"github.com/mitchellh/mapstructure"
)

func TestAppRole_EnableLocalSecretIDsRead(t *testing.T) {
var resp *logical.Response
var err error
b, storage := createBackendWithStorage(t)

roleData := map[string]interface{}{
"enable_local_secret_ids": true,
"bind_secret_id": true,
}

resp, err = b.HandleRequest(context.Background(), &logical.Request{
Operation: logical.CreateOperation,
Path: "role/testrole",
Storage: storage,
Data: roleData,
})
if err != nil || (resp != nil && resp.IsError()) {
t.Fatalf("err:%v resp:%#v", err, resp)
}

resp, err = b.HandleRequest(context.Background(), &logical.Request{
Operation: logical.ReadOperation,
Storage: storage,
Path: "role/testrole/enable-local-secret-ids",
})
if err != nil || (resp != nil && resp.IsError()) {
t.Fatalf("err:%v resp:%#v", err, resp)
}
if !resp.Data["enable_local_secret_ids"].(bool) {
t.Fatalf("expected enable_local_secret_ids to be returned")
}
}

func TestApprole_LocalNonLocalSecretIDs(t *testing.T) {
var resp *logical.Response
var err error
Expand Down

0 comments on commit 33256ab

Please sign in to comment.