1
0
Fork 0

Simplify username generation for the tests

No need to generate random numbers 10 times, generate a single big-enough one.
A single int64 should be more than enough
This commit is contained in:
jvoisin 2024-02-29 03:15:24 +01:00 committed by Frédéric Guillot
parent c493f8921e
commit e6524f925f

View file

@ -7,9 +7,9 @@
package tests package tests
import ( import (
"fmt"
"math"
"math/rand" "math/rand"
"strconv"
"strings"
"testing" "testing"
miniflux "miniflux.app/v2/client" miniflux "miniflux.app/v2/client"
@ -27,11 +27,7 @@ const (
) )
func getRandomUsername() string { func getRandomUsername() string {
var suffix []string return fmt.Sprintf("user%10d", rand.Intn(math.MaxInt64))
for range 10 {
suffix = append(suffix, strconv.Itoa(rand.Intn(1000)))
}
return "user" + strings.Join(suffix, "")
} }
func createClient(t *testing.T) *miniflux.Client { func createClient(t *testing.T) *miniflux.Client {