core/policy & core/token: Remove Dead Test Code (#7774)

* vault: remove dead test helper function testMakeBatchTokenViaCore()

* vault: remove dead test helper function testMakeBatchTokenViaBackend()

* vault: remove dead test helper function mockPolicyStoreNoCache()

* vault: remove dead test helper function mockPolicyStore()

* vault: remove unused test imports
This commit is contained in:
Lars Lehtonen 2019-11-04 01:36:07 -08:00 committed by Michel Vocks
parent 1dfdc35a14
commit bda6a6da78
2 changed files with 0 additions and 33 deletions

View File

@ -5,34 +5,9 @@ import (
"reflect"
"testing"
log "github.com/hashicorp/go-hclog"
"github.com/hashicorp/vault/helper/namespace"
"github.com/hashicorp/vault/sdk/helper/logging"
"github.com/hashicorp/vault/sdk/logical"
)
func mockPolicyStore(t *testing.T) *PolicyStore {
_, barrier, _ := mockBarrier(t)
view := NewBarrierView(barrier, "foo/")
p, err := NewPolicyStore(context.Background(), nil, view, logical.TestSystemView(), logging.NewVaultLogger(log.Trace))
if err != nil {
t.Fatal(err)
}
return p
}
func mockPolicyStoreNoCache(t *testing.T) *PolicyStore {
sysView := logical.TestSystemView()
sysView.CachingDisabledVal = true
_, barrier, _ := mockBarrier(t)
view := NewBarrierView(barrier, "foo/")
p, err := NewPolicyStore(context.Background(), nil, view, sysView, logging.NewVaultLogger(log.Trace))
if err != nil {
t.Fatal(err)
}
return p
}
func mockPolicyWithCore(t *testing.T, disableCache bool) (*Core, *PolicyStore) {
conf := &CoreConfig{
DisableCache: disableCache,

View File

@ -540,10 +540,6 @@ func getBackendConfig(c *Core) *logical.BackendConfig {
}
}
func testMakeBatchTokenViaBackend(t testing.TB, ts *TokenStore, root, client, ttl string, policy []string) {
testMakeTokenViaBackend(t, ts, root, client, ttl, policy, true)
}
func testMakeServiceTokenViaBackend(t testing.TB, ts *TokenStore, root, client, ttl string, policy []string) {
testMakeTokenViaBackend(t, ts, root, client, ttl, policy, false)
}
@ -647,10 +643,6 @@ func testMakeServiceTokenViaCore(t testing.TB, c *Core, root, client, ttl string
testMakeTokenViaCore(t, c, root, client, ttl, policy, false, nil)
}
func testMakeBatchTokenViaCore(t testing.TB, c *Core, root, client, ttl string, policy []string) {
testMakeTokenViaCore(t, c, root, client, ttl, policy, true, nil)
}
func testMakeTokenViaCore(t testing.TB, c *Core, root, client, ttl string, policy []string, batch bool, outAuth *logical.Auth) {
req := logical.TestRequest(t, logical.UpdateOperation, "auth/token/create")
req.ClientToken = root