feat: seed secure demo merchant identity
This commit is contained in:
24
internal/identity/password_test.go
Normal file
24
internal/identity/password_test.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package identity
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestHashPasswordAndVerifyPassword(t *testing.T) {
|
||||
t.Parallel()
|
||||
hash, err := HashPassword("correct horse battery staple")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !VerifyPassword("correct horse battery staple", hash) {
|
||||
t.Fatal("VerifyPassword() = false, want true")
|
||||
}
|
||||
if VerifyPassword("incorrect password", hash) {
|
||||
t.Fatal("VerifyPassword() = true for incorrect password")
|
||||
}
|
||||
}
|
||||
|
||||
func TestHashPasswordRejectsShortPassword(t *testing.T) {
|
||||
t.Parallel()
|
||||
if _, err := HashPassword("short"); err == nil {
|
||||
t.Fatal("HashPassword() error = nil, want length error")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user