You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

32 lines
713 B

package main
import (
"log"
"testing"
)
func TestRandomPassword(t *testing.T) {
password1, err := randomPassword()
if err != nil {
t.Errorf("Raised error: %s", err.Error())
}
password2, err := randomPassword()
if err != nil {
t.Errorf("Raised error: %s", err.Error())
}
log.Printf("Generated %s and %s", password1, password2)
if password1 != password2 {
log.Print("Passwords do not match.")
} else {
t.Errorf("Both passwords are %s", password1)
}
}
func TestRandomPasswordHashed(t *testing.T) {
password, hashedPassword, err := randomPasswordHashed()
if err != nil {
t.Errorf("Raised error: %s", err.Error())
} else {
log.Print("Generated: ", password, " and ", hashedPassword)
}
}