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


Golang FakeUserProvidedServiceInstanceRepository.CreateArgsForCall方法代码示例

本文整理汇总了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)
开发者ID:datatonic,项目名称:cli,代码行数:31,代码来源:create_user_provided_service_test.go

示例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)
开发者ID:vframbach,项目名称:cli,代码行数:31,代码来源:create_user_provided_service_test.go

示例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"},
开发者ID:rbramwell,项目名称:cli,代码行数:31,代码来源:create_user_provided_service_test.go


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