Beispiel #1
0
	"github.com/pivotal-golang/lager/lagertest"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Handler", func() {

	Describe("rate limiting", func() {

		var (
			noaaClient *fakes.FakeNoaaClient
			bbsClient  *fake_bbs.FakeClient

			logger *lagertest.TestLogger

			server                 *httptest.Server
			fakeActualLRPResponses chan []*models.ActualLRPGroup
			statsRequest           *http.Request
			statusRequest          *http.Request
			httpClient             *http.Client
		)

		BeforeEach(func() {
			var err error
			var httpHandler http.Handler

			httpClient = &http.Client{}
			logger = lagertest.NewTestLogger("test")
			bbsClient = new(fake_bbs.FakeClient)
			noaaClient = &fakes.FakeNoaaClient{}
Beispiel #2
0
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	. "github.com/onsi/gomega/gbytes"
)

var _ = Describe("Stats", func() {
	const authorization = "something good"
	const guid = "my-guid"
	const logGuid = "log-guid"

	var (
		handler    http.Handler
		response   *httptest.ResponseRecorder
		request    *http.Request
		noaaClient *fakes.FakeNoaaClient
		bbsClient  *fake_bbs.FakeClient
		logger     *lagertest.TestLogger
		fakeClock  *fakeclock.FakeClock
	)

	BeforeEach(func() {
		var err error

		bbsClient = new(fake_bbs.FakeClient)
		noaaClient = &fakes.FakeNoaaClient{}
		logger = lagertest.NewTestLogger("test")
		fakeClock = fakeclock.NewFakeClock(time.Date(2008, 8, 8, 8, 8, 8, 8, time.UTC))
		handler = lrpstats.NewHandler(bbsClient, noaaClient, fakeClock, logger)
		response = httptest.NewRecorder()
		request, err = http.NewRequest("GET", "/v1/actual_lrps/:guid/stats", nil)