mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +00:00
chore(testutil): add testutil.GetRandomName that does not return duplicates (#14020)
Fixes #13910 Adds testutil.GetRandomName that replaces namesgenerator.GetRandomName but instead appends a monotonically increasing integer instead of a number between 1 and 10.
This commit is contained in:
@ -7,13 +7,13 @@ import (
|
||||
"net/url"
|
||||
"testing"
|
||||
|
||||
"github.com/moby/moby/pkg/namesgenerator"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"golang.org/x/oauth2"
|
||||
|
||||
"github.com/coder/coder/v2/coderd/httpmw"
|
||||
"github.com/coder/coder/v2/codersdk"
|
||||
"github.com/coder/coder/v2/testutil"
|
||||
)
|
||||
|
||||
type testOAuth2Provider struct {
|
||||
@ -128,7 +128,7 @@ func TestOAuth2(t *testing.T) {
|
||||
})
|
||||
t.Run("PresetConvertState", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
customState := namesgenerator.GetRandomName(1)
|
||||
customState := testutil.GetRandomName(t)
|
||||
req := httptest.NewRequest("GET", "/?oidc_merge_state="+customState+"&redirect="+url.QueryEscape("/dashboard"), nil)
|
||||
res := httptest.NewRecorder()
|
||||
tp := newTestOAuth2Provider(t, oauth2.AccessTypeOffline)
|
||||
|
Reference in New Issue
Block a user