mirror of
https://github.com/writeas/web-core
synced 2018-07-20 11:55:21 +00:00
22 lines
323 B
Go
22 lines
323 B
Go
package auth
|
|
|
|
import "testing"
|
|
|
|
const pass = "password"
|
|
|
|
var hash []byte
|
|
|
|
func TestHash(t *testing.T) {
|
|
var err error
|
|
hash, err = HashPass([]byte(pass))
|
|
if err != nil {
|
|
t.Error("Password hash failed.")
|
|
}
|
|
}
|
|
|
|
func TestAuth(t *testing.T) {
|
|
if !Authenticated(hash, []byte(pass)) {
|
|
t.Error("Didn't authenticate.")
|
|
}
|
|
}
|