summary refs log tree commit diff stats
path: root/auth/checkpass_test.go
blob: d22bf48e9f23264b0beb571edccdf3715f4a5653 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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)
		}
	}
}