"github.com/appc/cni/pkg/types" "github.com/cloudfoundry-incubator/ducati-daemon/fakes" "github.com/cloudfoundry-incubator/ducati-daemon/handlers" "github.com/cloudfoundry-incubator/ducati-daemon/ipam" "github.com/cloudfoundry-incubator/ducati-daemon/models" "github.com/pivotal-golang/lager/lagertest" "github.com/tedsuo/rata" ) var _ = Describe("CNIAdd", func() { var ( unmarshaler *lfakes.Unmarshaler logger *lagertest.TestLogger controller *fakes.AddController handler http.Handler request *http.Request marshaler *lfakes.Marshaler expectedResultBytes []byte payload models.CNIAddPayload ) var setPayload = func() { payloadBytes, err := json.Marshal(payload) Expect(err).NotTo(HaveOccurred()) request.Body = ioutil.NopCloser(bytes.NewBuffer(payloadBytes)) } BeforeEach(func() { logger = lagertest.NewTestLogger("test") marshaler = &lfakes.Marshaler{} marshaler.MarshalStub = json.Marshal
"github.com/appc/cni/pkg/types" "github.com/cloudfoundry-incubator/ducati-daemon/client" "github.com/cloudfoundry-incubator/ducati-daemon/fakes" "github.com/cloudfoundry-incubator/ducati-daemon/models" "github.com/onsi/gomega/ghttp" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Client", func() { var ( c client.DaemonClient server *ghttp.Server marshaler *lfakes.Marshaler unmarshaler *lfakes.Unmarshaler roundTripper *fakes.RoundTripper httpClient *http.Client ) BeforeEach(func() { server = ghttp.NewServer() marshaler = &lfakes.Marshaler{} unmarshaler = &lfakes.Unmarshaler{} roundTripper = &fakes.RoundTripper{} roundTripper.RoundTripStub = http.DefaultTransport.RoundTrip httpClient = &http.Client{ Transport: roundTripper,
"github.com/cloudfoundry-incubator/ducati-daemon/fakes" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/onsi/gomega/ghttp" ) var _ = Describe("JSON Client", func() { Describe("BuildAndDo", func() { var ( jsonClient client.JSONClient server *ghttp.Server marshaler *lfakes.Marshaler unmarshaler *lfakes.Unmarshaler roundTripper *fakes.RoundTripper httpClient *http.Client config client.ClientConfig requestPayload []int responseResult map[string]string ) BeforeEach(func() { server = ghttp.NewServer() server.AppendHandlers(ghttp.CombineHandlers( ghttp.VerifyRequest("POST", "/some/path"), ghttp.RespondWithJSONEncoded(http.StatusCreated, map[string]string{"foo": "bar"}), )) marshaler = &lfakes.Marshaler{}