Files
threshold/internal/auth/oidc/ids_test.go
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
745 B
Go
Raw Normal View History

2023-02-02 17:15:17 -08:00
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
2021-04-08 20:54:32 -04:00
package oidc
import (
"context"
2021-04-08 20:54:32 -04:00
"strings"
"testing"
"github.com/hashicorp/boundary/globals"
2021-04-08 20:54:32 -04:00
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func Test_Ids(t *testing.T) {
t.Parallel()
ctx := context.TODO()
t.Run(globals.OidcAuthMethodPrefix, func(t *testing.T) {
id, err := newAuthMethodId(ctx)
2021-04-08 20:54:32 -04:00
require.NoError(t, err)
assert.True(t, strings.HasPrefix(id, globals.OidcAuthMethodPrefix+"_"))
2021-04-08 20:54:32 -04:00
})
t.Run(globals.OidcAccountPrefix, func(t *testing.T) {
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, globals.OidcAccountPrefix+"_"))
2021-04-08 20:54:32 -04:00
})
}