"github.com/pivotal-golang/lager" "github.com/pivotal-golang/lager/lagertest" "github.com/cloudfoundry-incubator/switchboard/api/middleware" "github.com/cloudfoundry-incubator/switchboard/api/middleware/fakes" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Logger", func() { var dummyRequest *http.Request var err error var fakeResponseWriter http.ResponseWriter var fakeHandler *fakes.FakeHandler var logger *lagertest.TestLogger var routePrefix string const fakePassword = "******" BeforeEach(func() { routePrefix = "/v0" dummyRequest, err = http.NewRequest("GET", "/v0/backends", nil) Expect(err).NotTo(HaveOccurred()) dummyRequest.Header.Add("Authorization", fakePassword) fakeResponseWriter = &apifakes.FakeResponseWriter{} fakeHandler = &fakes.FakeHandler{} logger = lagertest.NewTestLogger("backup-download-test")
import ( "net/http" "net/http/httptest" "github.com/cloudfoundry-incubator/switchboard/api/middleware" "github.com/cloudfoundry-incubator/switchboard/api/middleware/fakes" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("HttpsEnforcer", func() { var ( request *http.Request writer *httptest.ResponseRecorder fakeHandler *fakes.FakeHandler wrappedMiddleware http.Handler forceHttps bool ) BeforeEach(func() { forceHttps = true }) JustBeforeEach(func() { fakeHandler = &fakes.FakeHandler{} writer = httptest.NewRecorder() enforcer := middleware.NewHttpsEnforcer(forceHttps) wrappedMiddleware = enforcer.Wrap(fakeHandler) })