diff options
author | Andinus <andinus@nand.sh> | 2020-03-27 01:01:07 +0530 |
---|---|---|
committer | Andinus <andinus@nand.sh> | 2020-03-27 01:01:07 +0530 |
commit | 6384678d168f517fddf09135059793dc7281531f (patch) | |
tree | 2c8b423a0f7f4df8b2f5742c3f95d70a7825188a /auth/checkpass_test.go | |
parent | 7b8f753832aef334a6168ab253eced6dfbd2f720 (diff) | |
download | perseus-6384678d168f517fddf09135059793dc7281531f.tar.gz |
Add checkPass func and it's tests
Diffstat (limited to 'auth/checkpass_test.go')
-rw-r--r-- | auth/checkpass_test.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/auth/checkpass_test.go b/auth/checkpass_test.go new file mode 100644 index 0000000..d22bf48 --- /dev/null +++ b/auth/checkpass_test.go @@ -0,0 +1,19 @@ +package auth + +import ( + "testing" +) + +// TestCheckPass tests the checkPass function. +func TestCheckPass(t *testing.T) { + var passhash = make(map[string]string) + passhash["password"] = "$2a$10$hyV9vtsYXX88wz1rmA1x0.tcdkyvd6QsmV6gLOcR5wtYBE2GaSqT." + + for p, h := range passhash { + err := checkPass(p, h) + if err != nil { + t.Errorf("password: %s, hash: %s didn't match.", + p, h) + } + } +} |