2012-12-17 18:38:33 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bytes"
|
2017-10-23 16:23:46 +00:00
|
|
|
"github.com/stretchr/testify/assert"
|
2012-12-17 18:38:33 +00:00
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestHtpasswd(t *testing.T) {
|
|
|
|
file := bytes.NewBuffer([]byte("testuser:{SHA}PaVBVZkYqAjCQCu6UBL2xgsnZhw=\n"))
|
|
|
|
h, err := NewHtpasswd(file)
|
|
|
|
assert.Equal(t, err, nil)
|
|
|
|
|
|
|
|
valid := h.Validate("testuser", "asdf")
|
|
|
|
assert.Equal(t, valid, true)
|
|
|
|
}
|