mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-09 16:17:01 +02:00
* Move command/config + command/token to api/cliconfig + api/tokenhelper * Remove unused functions and unused import * Simplify and inline function copied from SDK * Delete unused duplicated/forwarding config implementation from command package * Delete unused code, unexport API surface that's only used internally to the package * Fix up license headers * Add changelog * Tweak .gitignore to track hcl files in testdata/ folders
39 lines
628 B
Go
39 lines
628 B
Go
// Copyright (c) HashiCorp, Inc.
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
package tokenhelper
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
// test is a public function that can be used in other tests to
|
|
// test that a helper is functioning properly.
|
|
func test(t *testing.T, h TokenHelper) {
|
|
if err := h.Store("foo"); err != nil {
|
|
t.Fatalf("err: %s", err)
|
|
}
|
|
|
|
v, err := h.Get()
|
|
if err != nil {
|
|
t.Fatalf("err: %s", err)
|
|
}
|
|
|
|
if v != "foo" {
|
|
t.Fatalf("bad: %#v", v)
|
|
}
|
|
|
|
if err := h.Erase(); err != nil {
|
|
t.Fatalf("err: %s", err)
|
|
}
|
|
|
|
v, err = h.Get()
|
|
if err != nil {
|
|
t.Fatalf("err: %s", err)
|
|
}
|
|
|
|
if v != "" {
|
|
t.Fatalf("bad: %#v", v)
|
|
}
|
|
}
|