photoprism/pkg/rnd/passcode_test.go
Michael Mayer ab491c3032 2FA: Add generator for random 16-digit app passwords #808
Signed-off-by: Michael Mayer <michael@photoprism.app>
2023-11-27 19:43:53 +01:00

21 lines
350 B
Go

package rnd
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestGeneratePasscode(t *testing.T) {
for n := 0; n < 10; n++ {
code := GeneratePasscode()
t.Logf("Passcode %d: %s", n, code)
assert.Equal(t, 19, len(code))
}
}
func BenchmarkGeneratePasscode(b *testing.B) {
for n := 0; n < b.N; n++ {
GeneratePasscode()
}
}