aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/auth/auth_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/auth/auth_test.go')
-rw-r--r--pkg/auth/auth_test.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/pkg/auth/auth_test.go b/pkg/auth/auth_test.go
index 7e0a5184f..d343e0f33 100644
--- a/pkg/auth/auth_test.go
+++ b/pkg/auth/auth_test.go
@@ -95,3 +95,15 @@ func TestBadHeader(t *testing.T) {
t.Errorf("Unexpected error %v %v", got, err)
}
}
+
+func TestBadHttpStatus(t *testing.T) {
+ ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.WriteHeader(400)
+ }))
+ defer ts.Close()
+ dut := MakeEndpoint(ts.URL)
+ got, err := dut.DetermineAuthSubj(time.Now(), []string{"Bearer x"})
+ if err == nil || !strings.HasSuffix(err.Error(), "400") || got != "" {
+ t.Errorf("Unexpected error %v %v", got, err)
+ }
+}