mirror of
https://github.com/hashicorp/vault.git
synced 2026-06-09 08:55:13 -04:00
Update tests for change in raw blacklisting
This commit is contained in:
parent
161e71adf3
commit
d7e8587a9f
1 changed files with 12 additions and 14 deletions
|
|
@ -3,6 +3,7 @@ package vault
|
|||
import (
|
||||
"crypto/sha256"
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
|
@ -876,19 +877,6 @@ func TestSystemBackend_rawRead_Protected(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestSystemBackend_rawRead(t *testing.T) {
|
||||
b := testSystemBackend(t)
|
||||
|
||||
req := logical.TestRequest(t, logical.ReadOperation, "raw/"+coreMountConfigPath)
|
||||
resp, err := b.HandleRequest(req)
|
||||
if err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
if resp.Data["value"].(string)[0] != '{' {
|
||||
t.Fatalf("bad: %v", resp)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSystemBackend_rawWrite_Protected(t *testing.T) {
|
||||
b := testSystemBackend(t)
|
||||
|
||||
|
|
@ -899,7 +887,7 @@ func TestSystemBackend_rawWrite_Protected(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestSystemBackend_rawWrite(t *testing.T) {
|
||||
func TestSystemBackend_rawReadWrite(t *testing.T) {
|
||||
c, b, _ := testCoreSystemBackend(t)
|
||||
|
||||
req := logical.TestRequest(t, logical.UpdateOperation, "raw/sys/policy/test")
|
||||
|
|
@ -912,6 +900,16 @@ func TestSystemBackend_rawWrite(t *testing.T) {
|
|||
t.Fatalf("bad: %v", resp)
|
||||
}
|
||||
|
||||
// Read via raw API
|
||||
req = logical.TestRequest(t, logical.ReadOperation, "raw/sys/policy/test")
|
||||
resp, err = b.HandleRequest(req)
|
||||
if err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
if !strings.HasPrefix(resp.Data["value"].(string), "path") {
|
||||
t.Fatalf("bad: %v", resp)
|
||||
}
|
||||
|
||||
// Read the policy!
|
||||
p, err := c.policyStore.GetPolicy("test")
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue