Files
threshold/internal/auth/oidc/client_secret_test.go
T
dd0f34bc35 Add new OIDC auth method. (#1090)
Co-authored-by: Todd Knight <T.Alan.Knight@gmail.com>
Co-authored-by: Jeff Mitchell <jeffrey.mitchell@gmail.com>
Co-authored-by: Michael Gaffney <mgaffney@users.noreply.github.com>
2021-04-08 20:54:32 -04:00

32 lines
824 B
Go

package oidc
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestClientSecret_String(t *testing.T) {
t.Parallel()
t.Run("redacted", func(t *testing.T) {
assert := assert.New(t)
const want = redactedClientSecret
tk := ClientSecret("super secret token")
assert.Equalf(want, tk.String(), "AccessToken.String() = %v, want %v", tk.String(), want)
})
}
func TestClientSecret_MarshalJSON(t *testing.T) {
t.Parallel()
t.Run("redacted", func(t *testing.T) {
assert, require := assert.New(t), require.New(t)
want := fmt.Sprintf(`"%s"`, redactedClientSecret)
tk := ClientSecret("super secret token")
got, err := tk.MarshalJSON()
require.NoError(err)
assert.Equalf([]byte(want), got, "AccessToken.MarshalJSON() = %s, want %s", got, want)
})
}