Exemplo n.º 1
0
	"code.cloudfoundry.org/rep/repfakes"
	"github.com/gogo/protobuf/proto"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	"testing"
)

func TestHandlers(t *testing.T) {
	RegisterFailHandler(Fail)
	RunSpecs(t, "Handlers Suite")
}

var (
	fakeServiceClient    *fake_bbs.FakeServiceClient
	fakeRepClient        *repfakes.FakeClient
	fakeRepClientFactory *repfakes.FakeClientFactory
)

var _ = BeforeEach(func() {
	fakeServiceClient = new(fake_bbs.FakeServiceClient)
	fakeRepClientFactory = new(repfakes.FakeClientFactory)
	fakeRepClient = new(repfakes.FakeClient)
	fakeRepClientFactory.CreateClientReturns(fakeRepClient, nil)
})

func newTestRequest(body interface{}) *http.Request {
	var reader io.Reader
	switch body := body.(type) {
	case io.Reader:
		reader = body
	"code.cloudfoundry.org/rep/repfakes"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/onsi/gomega/gbytes"
)

var _ = Describe("ActualLRP Lifecycle Handlers", func() {
	var (
		logger               *lagertest.TestLogger
		fakeActualLRPDB      *dbfakes.FakeActualLRPDB
		fakeDesiredLRPDB     *dbfakes.FakeDesiredLRPDB
		fakeAuctioneerClient *auctioneerfakes.FakeClient
		actualHub            *eventfakes.FakeHub
		responseRecorder     *httptest.ResponseRecorder
		handler              *handlers.ActualLRPLifecycleHandler
		exitCh               chan struct{}

		actualLRP      models.ActualLRP
		afterActualLRP models.ActualLRP

		fakeServiceClient    *fake_bbs.FakeServiceClient
		fakeRepClientFactory *repfakes.FakeClientFactory
		fakeRepClient        *repfakes.FakeClient
	)

	BeforeEach(func() {
		fakeActualLRPDB = new(dbfakes.FakeActualLRPDB)
		fakeAuctioneerClient = new(auctioneerfakes.FakeClient)
		fakeDesiredLRPDB = new(dbfakes.FakeDesiredLRPDB)
		logger = lagertest.NewTestLogger("test")
		responseRecorder = httptest.NewRecorder()