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


Golang FakePluginConfiguration.PluginsReturns方法代码示例

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


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

示例1:

				Commands: []plugin.Command{
					plugin.Command{
						Name:     "fakePluginCmd1",
						Alias:    "fpc1",
						HelpText: "help text here",
						UsageDetails: plugin.Usage{
							Usage: "Usage for fpc1",
							Options: map[string]string{
								"f": "test flag",
							},
						},
					},
				},
			}

			config.PluginsReturns(m)
		})

		Context("command is a plugin command name", func() {
			It("prints the usage help for the command", func() {
				runCommand("fakePluginCmd1")

				Eventually(ui.Outputs).Should(ContainSubstrings([]string{"fakePluginCmd1", "help text here"}))
				Eventually(ui.Outputs).Should(ContainSubstrings([]string{"ALIAS"}))
				Eventually(ui.Outputs).Should(ContainSubstrings([]string{"fpc1"}))
				Eventually(ui.Outputs).Should(ContainSubstrings([]string{"USAGE"}))
				Eventually(ui.Outputs).Should(ContainSubstrings([]string{"Usage for fpc1"}))
				Eventually(ui.Outputs).Should(ContainSubstrings([]string{"OPTIONS"}))
				Eventually(ui.Outputs).Should(ContainSubstrings([]string{"-f", "test flag"}))
			})
		})
开发者ID:vframbach,项目名称:cli,代码行数:31,代码来源:help_test.go

示例2:

			})
		})

		Context("when the plugin's alias conflicts with other installed plugin", func() {
			It("fails if it shares a command name", func() {
				pluginsMap := make(map[string]plugin_config.PluginMetadata)
				pluginsMap["AliasCollision"] = plugin_config.PluginMetadata{
					Location: "location/to/config.exe",
					Commands: []plugin.Command{
						{
							Name:     "conflict-alias",
							HelpText: "Hi!",
						},
					},
				}
				pluginConfig.PluginsReturns(pluginsMap)

				runCommand(aliasConflicts, "-f")

				Expect(ui.Outputs).To(ContainSubstrings(
					[]string{"Alias `conflict-alias` is a command/alias in plugin 'AliasCollision'.  You could try uninstalling plugin 'AliasCollision' and then install this plugin in order to invoke the `conflict-alias` command.  However, you should first fully understand the impact of uninstalling the existing 'AliasCollision' plugin."},
					[]string{"FAILED"},
				))
			})

			It("fails if it shares a command alias", func() {
				pluginsMap := make(map[string]plugin_config.PluginMetadata)
				pluginsMap["AliasCollision"] = plugin_config.PluginMetadata{
					Location: "location/to/alias.exe",
					Commands: []plugin.Command{
						{
开发者ID:emc-xchallenge,项目名称:cli,代码行数:31,代码来源:install_plugin_test.go

示例3:

		config = &testconfig.FakePluginConfiguration{}

		rpc.DefaultServer = rpc.NewServer()
	})

	runCommand := func(args ...string) bool {
		return testcmd.RunCliCommand("plugins", args, requirementsFactory, updateCommandDependency, false)
	}

	Context("If --checksum flag is provided", func() {
		It("computes and prints the sha1 checksum of the binary", func() {
			config.PluginsReturns(map[string]plugin_config.PluginMetadata{
				"Test1": plugin_config.PluginMetadata{
					Location: "../../../fixtures/plugins/test_1.go",
					Version:  plugin.VersionType{Major: 1, Minor: 2, Build: 3},
					Commands: []plugin.Command{
						{Name: "test_1_cmd1", HelpText: "help text for test_1_cmd1"},
					},
				},
			})

			runCommand("--checksum")

			Expect(ui.Outputs).To(ContainSubstrings(
				[]string{"Plugin Name", "Version", "sha1", "Command Help"},
			))
		})
	})

	It("should fail with usage when provided any arguments", func() {
		requirementsFactory.LoginSuccess = true
开发者ID:vframbach,项目名称:cli,代码行数:31,代码来源:plugins_test.go


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