diff --git a/server/pkg/service/util_test.go b/server/pkg/service/util_test.go index 8f17882..143904b 100644 --- a/server/pkg/service/util_test.go +++ b/server/pkg/service/util_test.go @@ -77,7 +77,7 @@ func TestIsPasswordCompromised(t *testing.T) { }) t.Run("randomly generated", func(t *testing.T) { - randomStr := genRandomString(12) + randomStr := genRandomString(t, 12) compromised, err := isPasswordCompromised(randomStr) assert.NoError(t, err) assert.False(t, compromised) @@ -173,7 +173,9 @@ func TestNormalizeUsername(t *testing.T) { } } -func genRandomString(length int) string { +func genRandomString(t *testing.T, length int) string { + t.Helper() + const charset = "abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" seededRand := rand.New(rand.NewSource(time.Now().UnixNano())) b := make([]byte, length)