本文整理汇总了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"},
))
示例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"},
))
示例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() {