github.com/cloudfoundry-attic/ltc@v0.0.0-20151123212628-098adc7919fc/receptor_client/receptor_client_test.go (about)

     1  package receptor_client_test
     2  
     3  import (
     4  	"net/http"
     5  	"reflect"
     6  
     7  	"github.com/cloudfoundry-incubator/ltc/receptor_client"
     8  
     9  	. "github.com/onsi/ginkgo"
    10  	. "github.com/onsi/gomega"
    11  )
    12  
    13  var _ = Describe("ReceptorClientCreator", func() {
    14  	var (
    15  		receptorClientCreator *receptor_client.ProxyAwareCreator
    16  	)
    17  
    18  	BeforeEach(func() {
    19  		receptorClientCreator = &receptor_client.ProxyAwareCreator{}
    20  	})
    21  
    22  	Context("#CreateReceptorClient", func() {
    23  		It("should add Proxy func back to the http client", func() {
    24  			client := receptorClientCreator.CreateReceptorClient("targethost")
    25  			actualProxyFunc := client.GetClient().Transport.(*http.Transport).Proxy
    26  			expectedProxyFunc := http.ProxyFromEnvironment
    27  			Expect(reflect.ValueOf(actualProxyFunc).Pointer()).To(Equal(reflect.ValueOf(expectedProxyFunc).Pointer()))
    28  		})
    29  	})
    30  })