Update tests for change in raw blacklisting

This commit is contained in:
Jeff Mitchell 2016-04-19 20:26:26 +00:00
parent 556039344a
commit 62058a0ff8
1 changed files with 12 additions and 14 deletions

View File

@ -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 {