Files
threshold/internal/credential/options_test.go
T
Jeff Mitchell cede1aec93 Add initial templating support to Vault credential libraries (#2569) (#2575)
Add initial templating support to Vault credential libraries

This adds support for templating various account and user values into
Vault dynamic credential library POST bodies and GET/POST paths.

It also unifies how parameters are used in grants, with backwards
compatibility.
2022-10-27 09:01:05 -04:00

22 lines
582 B
Go

package credential
import (
"testing"
"github.com/hashicorp/boundary/internal/util"
"github.com/hashicorp/boundary/internal/util/template"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func Test_GetOpts(t *testing.T) {
t.Parallel()
t.Run("WithTemplateData", func(t *testing.T) {
opts := getDefaultOptions()
assert.Empty(t, opts.WithTemplateData)
opts, err := GetOpts(WithTemplateData(template.Data{User: template.User{Id: util.Pointer("foo")}}))
require.NoError(t, err)
assert.Equal(t, "foo", *opts.WithTemplateData.User.Id)
})
}