mirror of
https://github.com/volatiletech/authboss.git
synced 2025-02-15 14:03:17 +02:00
Fix some broken tests
This commit is contained in:
parent
25eda89076
commit
5a62b6c20c
@ -144,13 +144,13 @@ func MountedMiddleware(ab *Authboss, mountPathed, redirectToLogin, forceFullAuth
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if u, err := ab.LoadCurrentUser(&r); err != nil {
|
if _, err := ab.LoadCurrentUser(&r); err == ErrUserNotFound {
|
||||||
|
fail(w, r)
|
||||||
|
return
|
||||||
|
} else if err != nil {
|
||||||
log.Errorf("error fetching current user: %+v", err)
|
log.Errorf("error fetching current user: %+v", err)
|
||||||
w.WriteHeader(http.StatusInternalServerError)
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
} else if u == nil {
|
|
||||||
fail(w, r)
|
|
||||||
return
|
|
||||||
} else {
|
} else {
|
||||||
next.ServeHTTP(w, r)
|
next.ServeHTTP(w, r)
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,8 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/davecgh/go-spew/spew"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAuthBossInit(t *testing.T) {
|
func TestAuthBossInit(t *testing.T) {
|
||||||
@ -135,6 +137,8 @@ func TestAuthbossMiddleware(t *testing.T) {
|
|||||||
|
|
||||||
rec, called, hadUser := setupMore(false, false, false, false)
|
rec, called, hadUser := setupMore(false, false, false, false)
|
||||||
|
|
||||||
|
spew.Dump(ab.Storage)
|
||||||
|
|
||||||
if rec.Code != http.StatusNotFound {
|
if rec.Code != http.StatusNotFound {
|
||||||
t.Error("wrong code:", rec.Code)
|
t.Error("wrong code:", rec.Code)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user