2021-04-08 20:54:32 -04:00
|
|
|
package oidc
|
|
|
|
|
|
|
|
|
|
import (
|
2021-07-29 18:52:56 -06:00
|
|
|
"context"
|
2021-04-08 20:54:32 -04:00
|
|
|
"strings"
|
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func Test_Ids(t *testing.T) {
|
|
|
|
|
t.Parallel()
|
2021-07-29 18:52:56 -06:00
|
|
|
ctx := context.TODO()
|
2021-04-08 20:54:32 -04:00
|
|
|
t.Run(AuthMethodPrefix, func(t *testing.T) {
|
2021-07-29 18:52:56 -06:00
|
|
|
id, err := newAuthMethodId(ctx)
|
2021-04-08 20:54:32 -04:00
|
|
|
require.NoError(t, err)
|
|
|
|
|
assert.True(t, strings.HasPrefix(id, AuthMethodPrefix+"_"))
|
|
|
|
|
})
|
|
|
|
|
t.Run(AccountPrefix, func(t *testing.T) {
|
2021-07-29 18:52:56 -06:00
|
|
|
id, err := newAccountId(ctx, "public-id", "test-issuer", "test-subject")
|
2021-04-08 20:54:32 -04:00
|
|
|
require.NoError(t, err)
|
|
|
|
|
assert.True(t, strings.HasPrefix(id, AccountPrefix+"_"))
|
|
|
|
|
})
|
|
|
|
|
}
|