package server_test import ( "net/http" "testing" "github.com/stretchr/testify/assert" ) func TestSettingsPageIsBehindLogin(t *testing.T) { t.Parallel() env := newTestEnv(t) w := env.get("/settings", nil) assert.Equal(t, http.StatusSeeOther, w.Code) assert.Equal( t, "/pages/login?next=%2Fsettings", w.Header().Get("Location"), ) w = env.get("/settings", env.authCookies(t, "id", "admin")) assert.Equal(t, http.StatusOK, w.Code) assert.Contains(t, w.Body.String(), "WEBHOOKER_ENVIRONMENT") }