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:
parent
c493f8921e
commit
e6524f925f
1 changed files with 3 additions and 7 deletions
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue