22 lines
505 B
Go
22 lines
505 B
Go
package auth
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"golang.org/x/crypto/bcrypt"
|
|
)
|
|
|
|
func TestRandomPluginOnlyPasswordFitsBcryptLimit(t *testing.T) {
|
|
password, err := randomPluginOnlyPassword()
|
|
if err != nil {
|
|
t.Fatalf("randomPluginOnlyPassword() error = %v", err)
|
|
}
|
|
|
|
if len(password) > 72 {
|
|
t.Fatalf("password length = %d, want <= 72", len(password))
|
|
}
|
|
if _, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost); err != nil {
|
|
t.Fatalf("bcrypt.GenerateFromPassword() error = %v", err)
|
|
}
|
|
}
|