package api import ( "fmt" "os" "testing" "golang.org/x/crypto/bcrypt" ) // The tests hash passwords at bcrypt's lowest cost: what they check is which // password is stored and who is signed out, not how slow a guess is. The // cost the server uses is checked first, so lowering it here can't hide a // weaker one there. func TestMain(m *testing.M) { if passwordCost < bcrypt.DefaultCost { fmt.Fprintf(os.Stderr, "passwordCost is %d; stored passwords need at least bcrypt.DefaultCost (%d)\n", passwordCost, bcrypt.DefaultCost) os.Exit(1) } passwordCost = bcrypt.MinCost os.Exit(m.Run()) }