github.com/cloudfoundry-attic/cli-with-i18n@v6.32.1-0.20171002233121-7401370d3b85+incompatible/integration/isolated/proxy_connection_test.go (about)

     1  package isolated
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/integration/helpers"
     5  	. "github.com/onsi/ginkgo"
     6  	. "github.com/onsi/gomega"
     7  	. "github.com/onsi/gomega/gbytes"
     8  	. "github.com/onsi/gomega/gexec"
     9  )
    10  
    11  var _ = Describe("proxy", func() {
    12  	var proxyURL string
    13  
    14  	BeforeEach(func() {
    15  		proxyURL = "127.0.0.1:9999"
    16  	})
    17  
    18  	Context("V2", func() {
    19  		It("errors when proxy is not setup properly", func() {
    20  			session := helpers.CFWithEnv(map[string]string{"https_proxy": proxyURL}, "api", apiURL)
    21  			Eventually(session.Err).Should(Say("%s/v2/info.*proxy.*%s", apiURL, proxyURL))
    22  			Eventually(session.Err).Should(Say("TIP: If you are behind a firewall and require an HTTP proxy, verify the https_proxy environment variable is correctly set. Else, check your network connection."))
    23  			Eventually(session).Should(Exit(1))
    24  		})
    25  	})
    26  
    27  	Context("V3", func() {
    28  		It("errors when proxy is not setup properly", func() {
    29  			session := helpers.CFWithEnv(map[string]string{"https_proxy": proxyURL}, "run-task", "app", "echo")
    30  			Eventually(session.Err).Should(Say("%s.*proxy.*%s", apiURL, proxyURL))
    31  			Eventually(session.Err).Should(Say("TIP: If you are behind a firewall and require an HTTP proxy, verify the https_proxy environment variable is correctly set. Else, check your network connection."))
    32  			Eventually(session).Should(Exit(1))
    33  		})
    34  	})
    35  })