A fast and simple blog backend.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
mediocre-blog/srv/src/http/auth_test.go

21 lines
392 B

package http
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestAuther(t *testing.T) {
password := "foo"
hashedPassword := NewPasswordHash(password)
auther := NewAuther(map[string]string{
"FOO": hashedPassword,
})
assert.False(t, auther.Allowed("BAR", password))
assert.False(t, auther.Allowed("FOO", "bar"))
assert.True(t, auther.Allowed("FOO", password))
}