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


Golang FakeCliConnection.GetAppsReturns方法代码示例

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


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

示例1:

		fakeCliConnection *fakes.FakeCliConnection
		appsList          []plugin_models.GetAppsModel
	)
	Context("When running wildcard-apps", func() {
		BeforeEach(func() {
			appsList = make([]plugin_models.GetAppsModel, 0)
			appsList = append(appsList,
				plugin_models.GetAppsModel{"spring-music", "", "", 0, 0, 0, 0, nil},
				plugin_models.GetAppsModel{"app321", "", "", 0, 0, 0, 0, nil},
			)
			fakeCliConnection = &fakes.FakeCliConnection{}
			wildcardPlugin = &Wildcard{}
		})
		Describe("When there are matching apps", func() {
			It("prints a table containing only those apps", func() {
				fakeCliConnection.GetAppsReturns(appsList, nil)
				output := io_helpers.CaptureOutput(func() {
					wildcardPlugin.Run(fakeCliConnection, []string{"wildcard-apps", "app*"})
				})

				Expect(output).To(ContainSubstrings(
					[]string{"app321"},
				))
				Expect(output).ToNot(ContainSubstrings(
					[]string{"spring-music"},
				))
			})
		})
		Describe("When there are matching apps", func() {
			It("prints a table containing only those apps", func() {
				fakeCliConnection.GetAppsReturns(appsList, nil)
开发者ID:lemaral,项目名称:Wildcard_Plugin,代码行数:31,代码来源:wildcard_plugin_test.go

示例2:

				"delete", "app-name",
				"-f",
			}))
		})

		It("returns errors from the delete", func() {
			cliConn.CliCommandReturns([]string{}, errors.New("bad app"))

			err := repo.DeleteApplication("app-name")
			Ω(err).Should(MatchError("bad app"))
		})
	})

	Describe("ListApplications", func() {
		Context("when we called", func() {
			It("then it should call the get apps list api", func() {
				err := repo.ListApplications()
				Ω(err).ShouldNot(HaveOccurred())
				Ω(cliConn.GetAppsCallCount()).Should(Equal(1))
			})
		})
		Context("when the get apps call yields an error", func() {
			It("then it should return the errors ", func() {
				cliConn.GetAppsReturns(nil, errors.New("bad apps"))
				err := repo.ListApplications()
				Ω(err).Should(MatchError("bad apps"))
			})
		})
	})
})
开发者ID:xchapter7x,项目名称:autopilot,代码行数:30,代码来源:application_repo_test.go

示例3:

		var (
			controlAppName          = "myapp"
			controlAppNameVenerable = fmt.Sprintf("%s-venerable", controlAppName)
			controlCallChain        = [][]string{
				[]string{"rename", controlAppName, controlAppNameVenerable},
				[]string{"push", controlAppName},
				[]string{"delete", controlAppNameVenerable, "-f"},
			}
			controlCallCount = len(controlCallChain)
		)

		BeforeEach(func() {
			cliConn.GetAppsReturns([]plugin_models.GetAppsModel{
				plugin_models.GetAppsModel{
					Name: controlAppName,
				},
				plugin_models.GetAppsModel{
					Name: "and-other-stuff",
				},
			}, nil)
			autopilotPlugin.Run(cliConn, []string{"push-zdd", controlAppName})
		})
		It("then it should rename the existing app to venerable", func() {
			callCount := cliConn.CliCommandCallCount()

			for i := 0; i < callCount; i++ {
				called := cliConn.CliCommandArgsForCall(i)
				fmt.Println(called)
				Ω(true).Should(BeTrue())
			}
		})
开发者ID:xchapter7x,项目名称:autopilot,代码行数:31,代码来源:autopilot_test.go


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