mirror of
https://github.com/volatiletech/authboss.git
synced 2024-11-24 08:42: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
|
||||
}
|
||||
|
||||
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)
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
return
|
||||
} else if u == nil {
|
||||
fail(w, r)
|
||||
return
|
||||
} else {
|
||||
next.ServeHTTP(w, r)
|
||||
}
|
||||
|
@ -5,6 +5,8 @@ import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
)
|
||||
|
||||
func TestAuthBossInit(t *testing.T) {
|
||||
@ -135,6 +137,8 @@ func TestAuthbossMiddleware(t *testing.T) {
|
||||
|
||||
rec, called, hadUser := setupMore(false, false, false, false)
|
||||
|
||||
spew.Dump(ab.Storage)
|
||||
|
||||
if rec.Code != http.StatusNotFound {
|
||||
t.Error("wrong code:", rec.Code)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user