2023-02-02 17:15:17 -08:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
2020-07-31 11:18:41 -04:00
|
|
|
// SPDX-License-Identifier: BUSL-1.1
|
2023-02-02 17:15:17 -08:00
|
|
|
|
2020-07-29 07:58:19 -04:00
|
|
|
package password
|
|
|
|
|
|
|
|
|
|
import (
|
2023-06-06 17:09:08 -04:00
|
|
|
"context"
|
2020-07-29 07:58:19 -04:00
|
|
|
"strings"
|
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func Test_PrivateIds(t *testing.T) {
|
2023-06-06 17:09:08 -04:00
|
|
|
ctx := context.Background()
|
2020-07-29 07:58:19 -04:00
|
|
|
t.Run("argon2Config", func(t *testing.T) {
|
2023-06-06 17:09:08 -04:00
|
|
|
id, err := newArgon2ConfigurationId(ctx)
|
2020-07-29 07:58:19 -04:00
|
|
|
require.NoError(t, err)
|
|
|
|
|
assert.True(t, strings.HasPrefix(id, argon2ConfigurationPrefix+"_"))
|
|
|
|
|
})
|
2020-07-31 11:18:41 -04:00
|
|
|
t.Run("argon2Cred", func(t *testing.T) {
|
2023-06-06 17:09:08 -04:00
|
|
|
id, err := newArgon2CredentialId(ctx)
|
2020-07-31 11:18:41 -04:00
|
|
|
require.NoError(t, err)
|
|
|
|
|
assert.True(t, strings.HasPrefix(id, argon2CredentialPrefix+"_"))
|
|
|
|
|
})
|
2020-07-29 07:58:19 -04:00
|
|
|
}
|