mirror of
https://github.com/hashicorp/vault.git
synced 2025-11-23 03:31:09 +01:00
* license: update headers to IBM Corp. * `make proto` * update offset because source file changed Signed-off-by: Ryan Cragun <me@ryan.ec> Co-authored-by: Ryan Cragun <me@ryan.ec>
39 lines
629 B
Go
39 lines
629 B
Go
// Copyright IBM Corp. 2016, 2025
|
|
// 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)
|
|
}
|
|
}
|