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.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/srv/src/http/auth_test.go b/srv/src/http/auth_test.go
index 2a1e6e9..9e2d440 100644
--- a/srv/src/http/auth_test.go
+++ b/srv/src/http/auth_test.go
@@ -1,21 +1,24 @@
package http
import (
+ "context"
"testing"
+ "time"
"github.com/stretchr/testify/assert"
)
func TestAuther(t *testing.T) {
+ ctx := context.Background()
password := "foo"
hashedPassword := NewPasswordHash(password)
auther := NewAuther(map[string]string{
"FOO": hashedPassword,
- })
+ }, 1*time.Millisecond)
- assert.False(t, auther.Allowed("BAR", password))
- assert.False(t, auther.Allowed("FOO", "bar"))
- assert.True(t, auther.Allowed("FOO", password))
+ assert.False(t, auther.Allowed(ctx, "BAR", password))
+ assert.False(t, auther.Allowed(ctx, "FOO", "bar"))
+ assert.True(t, auther.Allowed(ctx, "FOO", password))
}