1
0
mirror of https://github.com/volatiletech/authboss.git synced 2024-11-28 08:58:38 +02:00

Fix some broken tests

This commit is contained in:
Aaron L 2018-10-28 23:28:04 -07:00
parent 25eda89076
commit 5a62b6c20c
2 changed files with 8 additions and 4 deletions

View File

@ -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)
}

View File

@ -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)
}