snapshot of https://github.com/traggo/server.git (master, 2026-09-16; blobs > 131072B omitted)
Some checks failed
build / build (push) Failing after 3s
Some checks failed
build / build (push) Failing after 3s
This commit is contained in:
21
user/password/password_test.go
Normal file
21
user/password/password_test.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package password
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestPasswordSuccess(t *testing.T) {
|
||||
password := CreatePassword("secret", 4)
|
||||
assert.Equal(t, true, ComparePassword(password, []byte("secret")))
|
||||
}
|
||||
|
||||
func TestPasswordFailure(t *testing.T) {
|
||||
password := CreatePassword("secret", 4)
|
||||
assert.Equal(t, false, ComparePassword(password, []byte("secretx")))
|
||||
}
|
||||
|
||||
func TestBCryptFailure(t *testing.T) {
|
||||
assert.Panics(t, func() { CreatePassword("secret", 12312) })
|
||||
}
|
||||
Reference in New Issue
Block a user