本文整理汇总了Golang中github.com/cloudfoundry/cli/cf/actors/plugin_repo/fakes.FakePluginRepo.GetPluginsReturns方法的典型用法代码示例。如果您正苦于以下问题:Golang FakePluginRepo.GetPluginsReturns方法的具体用法?Golang FakePluginRepo.GetPluginsReturns怎么用?Golang FakePluginRepo.GetPluginsReturns使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry/cli/cf/actors/plugin_repo/fakes.FakePluginRepo
的用法示例。
在下文中一共展示了FakePluginRepo.GetPluginsReturns方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
Describe("install from plugin repository when '-r' provided", func() {
Context("gets metadata of the plugin from repo", func() {
Context("when repo is not found in config", func() {
It("informs user repo is not found", func() {
runCommand("plugin1", "-r", "repo1", "-f")
Ω(ui.Outputs).To(ContainSubstrings([]string{"Looking up 'plugin1' from repository 'repo1'"}))
Ω(ui.Outputs).To(ContainSubstrings([]string{"repo1 not found"}))
})
})
Context("when repo is found in config", func() {
Context("when repo endpoint returns an error", func() {
It("informs user about the error", func() {
config.SetPluginRepo(models.PluginRepo{Name: "repo1", Url: ""})
fakePluginRepo.GetPluginsReturns(nil, []string{"repo error1"})
runCommand("plugin1", "-r", "repo1", "-f")
Ω(ui.Outputs).To(ContainSubstrings([]string{"Error getting plugin metadata from repo"}))
Ω(ui.Outputs).To(ContainSubstrings([]string{"repo error1"}))
})
})
Context("when plugin metadata is available and desired plugin is not found", func() {
It("informs user about the error", func() {
config.SetPluginRepo(models.PluginRepo{Name: "repo1", Url: ""})
fakePluginRepo.GetPluginsReturns(nil, nil)
runCommand("plugin1", "-r", "repo1", "-f")
Ω(ui.Outputs).To(ContainSubstrings([]string{"plugin1 is not available in repo 'repo1'"}))
})
示例2:
Context("when GetPlugins returns a list of plugin meta data", func() {
It("lists all plugin data", func() {
result := make(map[string][]clipr.Plugin)
result["repo1"] = []clipr.Plugin{
clipr.Plugin{
Name: "plugin1",
Description: "none1",
},
}
result["repo2"] = []clipr.Plugin{
clipr.Plugin{
Name: "plugin2",
Description: "none2",
},
}
fakePluginRepo.GetPluginsReturns(result, []string{})
callRepoPlugins()
Ω(ui.Outputs).ToNot(ContainSubstrings([]string{"Logged errors:"}))
Ω(ui.Outputs).To(ContainSubstrings([]string{"repo1"}))
Ω(ui.Outputs).To(ContainSubstrings([]string{"plugin1"}))
Ω(ui.Outputs).To(ContainSubstrings([]string{"repo2"}))
Ω(ui.Outputs).To(ContainSubstrings([]string{"plugin2"}))
})
})
Context("If errors are reported back from GetPlugins()", func() {
It("informs user about the errors", func() {
fakePluginRepo.GetPluginsReturns(nil, []string{
"error from repo1",