本文整理汇总了Golang中github.com/cloudfoundry/cli/cf/api/fakes.FakeUserProvidedServiceInstanceRepository.CreateArgsForCall方法的典型用法代码示例。如果您正苦于以下问题:Golang FakeUserProvidedServiceInstanceRepository.CreateArgsForCall方法的具体用法?Golang FakeUserProvidedServiceInstanceRepository.CreateArgsForCall怎么用?Golang FakeUserProvidedServiceInstanceRepository.CreateArgsForCall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry/cli/cf/api/fakes.FakeUserProvidedServiceInstanceRepository
的用法示例。
在下文中一共展示了FakeUserProvidedServiceInstanceRepository.CreateArgsForCall方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
[]string{"OK"},
))
})
It("accepts service parameters interactively", func() {
ui.Inputs = []string{"foo value", "bar value", "baz value"}
testcmd.RunCliCommand("create-user-provided-service", []string{"-p", `"foo, bar, baz"`, "my-custom-service"}, requirementsFactory, updateCommandDependency, false)
Expect(ui.Prompts).To(ContainSubstrings(
[]string{"foo"},
[]string{"bar"},
[]string{"baz"},
))
Expect(repo.CreateCallCount()).To(Equal(1))
name, drainUrl, _, params := repo.CreateArgsForCall(0)
Expect(name).To(Equal("my-custom-service"))
Expect(drainUrl).To(Equal(""))
Expect(params["foo"]).To(Equal("foo value"))
Expect(params["bar"]).To(Equal("bar value"))
Expect(params["baz"]).To(Equal("baz value"))
Expect(ui.Outputs).To(ContainSubstrings(
[]string{"Creating user provided service", "my-custom-service", "my-org", "my-space", "my-user"},
[]string{"OK"},
))
})
It("accepts service parameters as JSON without prompting", func() {
args := []string{"-p", `{"foo": "foo value", "bar": "bar value", "baz": 4}`, "my-custom-service"}
testcmd.RunCliCommand("create-user-provided-service", args, requirementsFactory, updateCommandDependency, false)
示例2:
[]string{"OK"},
))
})
It("accepts service parameters interactively", func() {
ui.Inputs = []string{"foo value", "bar value", "baz value"}
testcmd.RunCliCommand("create-user-provided-service", []string{"-p", `"foo, bar, baz"`, "my-custom-service"}, requirementsFactory, updateCommandDependency, false)
Expect(ui.Prompts).To(ContainSubstrings(
[]string{"foo"},
[]string{"bar"},
[]string{"baz"},
))
Expect(repo.CreateCallCount()).To(Equal(1))
name, drainUrl, params := repo.CreateArgsForCall(0)
Expect(name).To(Equal("my-custom-service"))
Expect(drainUrl).To(Equal(""))
Expect(params["foo"]).To(Equal("foo value"))
Expect(params["bar"]).To(Equal("bar value"))
Expect(params["baz"]).To(Equal("baz value"))
Expect(ui.Outputs).To(ContainSubstrings(
[]string{"Creating user provided service", "my-custom-service", "my-org", "my-space", "my-user"},
[]string{"OK"},
))
})
It("accepts service parameters as JSON without prompting", func() {
args := []string{"-p", `{"foo": "foo value", "bar": "bar value", "baz": 4}`, "my-custom-service"}
testcmd.RunCliCommand("create-user-provided-service", args, requirementsFactory, updateCommandDependency, false)
示例3:
Expect(err).NotTo(HaveOccurred())
_, err = cmd.Requirements(factory, flagContext)
Expect(err).NotTo(HaveOccurred())
})
It("tells the user it will create the user provided service", func() {
cmd.Execute(flagContext)
Expect(ui.Outputs).To(ContainSubstrings(
[]string{"Creating user provided service service-instance in org"},
))
})
It("tries to create the user provided service instance", func() {
cmd.Execute(flagContext)
Expect(serviceInstanceRepo.CreateCallCount()).To(Equal(1))
name, drainURL, routeServiceURL, credentialsMap := serviceInstanceRepo.CreateArgsForCall(0)
Expect(name).To(Equal("service-instance"))
Expect(drainURL).To(Equal(""))
Expect(routeServiceURL).To(Equal(""))
Expect(credentialsMap).To(Equal(map[string]interface{}{}))
})
Context("when creating the user provided service instance succeeds", func() {
BeforeEach(func() {
serviceInstanceRepo.CreateReturns(nil)
})
It("tells the user OK", func() {
cmd.Execute(flagContext)
Expect(ui.Outputs).To(ContainSubstrings(
[]string{"OK"},