Пример #1
0
	Context("when the user provides the --skip-ssl-validation flag", func() {
		It("updates the SSLDisabled field in config", func() {
			config.SetSSLDisabled(false)
			callApi([]string{"--skip-ssl-validation", "https://example.com"}, config, endpointRepo)

			Expect(config.IsSSLDisabled()).To(Equal(true))
		})
	})

	Context("the user provides an endpoint", func() {
		Describe("when the user passed in the skip-ssl-validation flag", func() {
			It("disables SSL validation in the config", func() {
				callApi([]string{"--skip-ssl-validation", "https://example.com"}, config, endpointRepo)

				Expect(endpointRepo.UpdateEndpointCallCount()).To(Equal(1))
				Expect(endpointRepo.UpdateEndpointArgsForCall(0)).To(Equal("https://example.com"))
				Expect(config.IsSSLDisabled()).To(BeTrue())
			})
		})

		Context("when the user passed in the unset flag", func() {
			Context("when the config.ApiEndpoint is set", func() {
				BeforeEach(func() {
					config.SetApiEndpoint("some-silly-thing")
					ui = new(testterm.FakeUI)
				})

				It("unsets the ApiEndpoint", func() {
					callApi([]string{"--unset", "https://example.com"}, config, endpointRepo)