summaryrefslogtreecommitdiff
path: root/srv/src/http/auth_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'srv/src/http/auth_test.go')
-rw-r--r--srv/src/http/auth_test.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/srv/src/http/auth_test.go b/srv/src/http/auth_test.go
new file mode 100644
index 0000000..2a1e6e9
--- /dev/null
+++ b/srv/src/http/auth_test.go
@@ -0,0 +1,21 @@
+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))
+}