2022-10-27 09:01:05 -04:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
2023-02-02 17:15:17 -08:00
|
|
|
// SPDX-License-Identifier: BUSL-1.1
|
|
|
|
|
|
2022-10-27 09:01:05 -04:00
|
|
|
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)
|
|
|
|
|
})
|
|
|
|
|
}
|