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


Golang FakeUserProvidedServiceInstanceRepository.UpdateArgsForCall方法代码示例

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


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

示例1:

				))
			})
		})

		Context("when the user provides valid JSON with the -p flag", func() {
			It("updates the user provided service specified", func() {
				runCommand("-p", `{"foo":"bar"}`, "-l", "syslog://example.com", "service-name")

				Expect(requirementsFactory.ServiceInstanceName).To(Equal("service-name"))
				Expect(ui.Outputs).To(ContainSubstrings(
					[]string{"Updating user provided service", "service-name", "my-org", "my-space", "my-user"},
					[]string{"OK"},
					[]string{"TIP"},
				))

				Expect(serviceRepo.UpdateArgsForCall(0).Name).To(Equal("service-name"))
				Expect(serviceRepo.UpdateArgsForCall(0).Params).To(Equal(map[string]interface{}{"foo": "bar"}))
				Expect(serviceRepo.UpdateArgsForCall(0).SysLogDrainUrl).To(Equal("syslog://example.com"))
			})
		})

		Context("when the user provides invalid JSON with the -p flag", func() {
			It("tells the user the JSON is invalid", func() {
				runCommand("-p", `{"foo":"ba WHOOPS OH MY HOW DID THIS GET HERE???`, "service-name")

				Expect(serviceRepo.UpdateCallCount()).To(Equal(0))

				Expect(ui.Outputs).To(ContainSubstrings(
					[]string{"FAILED"},
					[]string{"JSON is invalid"},
				))
开发者ID:vframbach,项目名称:cli,代码行数:31,代码来源:update_user_provided_service_test.go

示例2:

				))
			})
		})

		Context("when the user provides valid single-quoted JSON with the -p flag", func() {
			It("updates the user provided service specified", func() {
				runCommand("-p", `'{"foo":"bar"}'`, "-l", "syslog://example.com", "service-name")

				Expect(requirementsFactory.ServiceInstanceName).To(Equal("service-name"))
				Expect(ui.Outputs).To(ContainSubstrings(
					[]string{"Updating user provided service", "service-name", "my-org", "my-space", "my-user"},
					[]string{"OK"},
					[]string{"TIP"},
				))

				Expect(serviceRepo.UpdateArgsForCall(0).Name).To(Equal("service-name"))
				Expect(serviceRepo.UpdateArgsForCall(0).Params).To(Equal(map[string]interface{}{"foo": "bar"}))
				Expect(serviceRepo.UpdateArgsForCall(0).SysLogDrainUrl).To(Equal("syslog://example.com"))
			})
		})

		Context("when the user provides valid double-quoted JSON with the -p flag", func() {
			It("updates the user provided service specified", func() {
				runCommand("-p", `"{"foo":"bar"}"`, "-l", "syslog://example.com", "service-name")

				Expect(requirementsFactory.ServiceInstanceName).To(Equal("service-name"))
				Expect(ui.Outputs).To(ContainSubstrings(
					[]string{"Updating user provided service", "service-name", "my-org", "my-space", "my-user"},
					[]string{"OK"},
					[]string{"TIP"},
				))
开发者ID:sunatthegilddotcom,项目名称:cli,代码行数:31,代码来源:update_user_provided_service_test.go

示例3:

				serviceInstance.Name = "service-instance"
				serviceInstance.Params = map[string]interface{}{}
				serviceInstanceRequirement.GetServiceInstanceReturns(serviceInstance)
			})

			It("tells the user it is updating the user provided service", func() {
				cmd.Execute(flagContext)
				Expect(ui.Outputs).To(ContainSubstrings(
					[]string{"Updating user provided service service-instance in org"},
				))
			})

			It("tries to update the service instance", func() {
				cmd.Execute(flagContext)
				Expect(serviceInstanceRepo.UpdateCallCount()).To(Equal(1))
				Expect(serviceInstanceRepo.UpdateArgsForCall(0)).To(Equal(serviceInstance.ServiceInstanceFields))
			})

			It("tells the user no changes were made", func() {
				cmd.Execute(flagContext)
				Expect(ui.Outputs).To(ContainSubstrings(
					[]string{"No flags specified. No changes were made."},
				))
			})

			Context("when the -p flag is passed with inline JSON", func() {
				BeforeEach(func() {
					flagContext.Parse("service-instance", "-p", `"{"some":"json"}"`)
				})

				It("tries to update the user provided service instance with the credentials", func() {
开发者ID:rbramwell,项目名称:cli,代码行数:31,代码来源:update_user_provided_service_test.go


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