当前位置: 首页>>代码示例>>Golang>>正文


Golang FakeEndpointRepo.UpdateEndpointError方法代码示例

本文整理汇总了Golang中github.com/cloudfoundry/cli/cf/api/fakes.FakeEndpointRepo.UpdateEndpointError方法的典型用法代码示例。如果您正苦于以下问题:Golang FakeEndpointRepo.UpdateEndpointError方法的具体用法?Golang FakeEndpointRepo.UpdateEndpointError怎么用?Golang FakeEndpointRepo.UpdateEndpointError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/cloudfoundry/cli/cf/api/fakes.FakeEndpointRepo的用法示例。


在下文中一共展示了FakeEndpointRepo.UpdateEndpointError方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1:

						Config.SetSSLDisabled(false)
					})

					ItSucceeds()
					ItShowsTheTarget()

					It("stores the API endpoint and the skip-ssl flag", func() {
						Expect(endpointRepo.UpdateEndpointReceived).To(Equal("https://api.the-server.com"))
						Expect(Config.IsSSLDisabled()).To(BeTrue())
					})
				})

				Describe("setting api endpoint failed", func() {
					BeforeEach(func() {
						Config.SetSSLDisabled(true)
						endpointRepo.UpdateEndpointError = errors.New("API endpoint not found")
					})

					ItFails()
					ItDoesntShowTheTarget()

					It("clears the entire config", func() {
						Expect(Config.ApiEndpoint()).To(BeEmpty())
						Expect(Config.IsSSLDisabled()).To(BeFalse())
						Expect(Config.AccessToken()).To(BeEmpty())
						Expect(Config.RefreshToken()).To(BeEmpty())
						Expect(Config.OrganizationFields().Guid).To(BeEmpty())
						Expect(Config.SpaceFields().Guid).To(BeEmpty())
					})
				})
			})
开发者ID:vframbach,项目名称:cli,代码行数:31,代码来源:login_test.go

示例2:

		BeforeEach(func() {
			requirementsFactory.ApiEndpointSuccess = true
		})

		Context("calling endpoint repository to update 'app_ssh_oauth_client'", func() {
			It("passes the repo the targeted API endpoint", func() {
				configRepo.SetApiEndpoint("test.endpoint.com")

				runCommand()
				Ω(endpointRepo.CallCount).To(Equal(1))
				Ω(endpointRepo.UpdateEndpointReceived).To(Equal(configRepo.ApiEndpoint()))
			})

			It("reports any error to user", func() {
				configRepo.SetApiEndpoint("test.endpoint.com")
				endpointRepo.UpdateEndpointError = errors.New("endpoint error")

				runCommand()
				Ω(endpointRepo.CallCount).To(Equal(1))
				Ω(ui.Outputs).To(ContainSubstrings(
					[]string{"Error getting info", "endpoint error"},
				))
			})
		})

		Context("refresh oauth-token to make sure it is not stale", func() {
			It("refreshes the oauth token to make sure it is not stale", func() {
				runCommand()
				Ω(authRepo.RefreshTokenCalled).To(BeTrue())
			})
开发者ID:vframbach,项目名称:cli,代码行数:30,代码来源:ssh_code_test.go

示例3:

	callApi := func(args []string, config core_config.Repository, endpointRepo *testapi.FakeEndpointRepo) {
		testcmd.RunCliCommand("api", args, requirementsFactory, updateCommandDependency, false)
	}

	BeforeEach(func() {
		ui = new(testterm.FakeUI)
		requirementsFactory = &testreq.FakeReqFactory{}
		config = testconfig.NewRepository()
		endpointRepo = &testapi.FakeEndpointRepo{}
		deps = command_registry.NewDependency()
	})

	Context("when the api endpoint's ssl certificate is invalid", func() {
		It("warns the user and prints out a tip", func() {
			endpointRepo.UpdateEndpointError = errors.NewInvalidSSLCert("https://buttontomatoes.org", "why? no. go away")
			callApi([]string{"https://buttontomatoes.org"}, config, endpointRepo)

			Expect(ui.Outputs).To(ContainSubstrings(
				[]string{"FAILED"},
				[]string{"SSL Cert", "https://buttontomatoes.org"},
				[]string{"TIP", "--skip-ssl-validation"},
			))
		})
	})

	Context("when the user does not provide an endpoint", func() {
		Context("when the endpoint is set in the config", func() {
			BeforeEach(func() {
				config.SetApiEndpoint("https://api.run.pivotal.io")
				config.SetApiVersion("2.0")
开发者ID:vframbach,项目名称:cli,代码行数:30,代码来源:api_test.go


注:本文中的github.com/cloudfoundry/cli/cf/api/fakes.FakeEndpointRepo.UpdateEndpointError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。