Beispiel #1
0
    def test_list(self, mock_plugin_commands__print_plugins_list):

        plugin_cmd.PluginCommands().list(None, None, "p1_ns")
        plugin_cmd.PluginCommands().list(None, "p1", "p1_ns")
        plugin_cmd.PluginCommands().list(None, "p2", None)

        mock_plugin_commands__print_plugins_list.assert_has_calls([
            mock.call([self.Plugin1]),
            mock.call([self.Plugin1]),
            mock.call([self.Plugin2])
        ])
Beispiel #2
0
    def setUp(self):
        super(PluginCommandsTestCase, self).setUp()
        self.plugin_cmd = plugin_cmd.PluginCommands()

        @plugin.configure("p1", "p1_ns")
        class Plugin1(plugin.Plugin):
            """T1.

            Description of T1

            :param x: x arg
            :param y: y arg
            """
            pass

        self.Plugin1 = Plugin1

        @plugin.configure("p2", "p2_ns")
        class Plugin2(plugin.Plugin):
            """T2."""
            pass

        self.Plugin2 = Plugin2

        @plugin.configure("p3", "p2_ns")
        class Plugin3(plugin.Plugin):
            """T3."""
            pass

        self.Plugin3 = Plugin3
Beispiel #3
0
    def test_show(self):
        with utils.StdOutCapture() as out:
            plugin_cmd.PluginCommands().show(None, "p1", "p1_ns")
            output = out.getvalue()

            self.assertIn("NAME\n\tp1", output)
            self.assertIn("PLATFORM\n\tp1_ns", output)
            self.assertIn("cli.commands.test_plugin", output)
            self.assertIn("DESCRIPTION\n\tDescription of T1", output)
            self.assertIn("PARAMETERS", output)
Beispiel #4
0
    def list(self):
        """List main entities in Rally for which rally info find works.

        Lists task scenario groups, deploy engines and server providers.
        """
        print("This command was deprecated, and will be removed in 0.2.0 use:")
        print("rally plugin list")

        plugin.PluginCommands().list()
        return 1
Beispiel #5
0
    def find(self, query):
        """Search for an entity that matches the query and print info about it.

        :param query: search query.
        """
        print("This command was deprecated, and will be removed in 0.2.0 use:")
        print("rally plugin show %s" % query)

        plugin.PluginCommands().show(query)
        return 1
Beispiel #6
0
    def test_show_many(self, mock_plugin_commands__print_plugins_list):
        with utils.StdOutCapture() as out:
            with mock.patch("rally.cli.commands.plugin.plugin.Plugin."
                            "get_all") as mock_plugin_get_all:
                mock_plugin_get_all.return_value = [self.Plugin2, self.Plugin3]
                plugin_cmd.PluginCommands().show(None, "p", "p2_ns")
                self.assertEqual("Multiple plugins found:\n", out.getvalue())
                mock_plugin_get_all.assert_called_once_with(platform="p2_ns")

        mock_plugin_commands__print_plugins_list.assert_called_once_with(
            [self.Plugin2, self.Plugin3])
Beispiel #7
0
    def test_list_not_found(self, name, platform, text):

        with utils.StdOutCapture() as out:
            plugin_cmd.PluginCommands().list(None, name, platform)
            self.assertEqual(text, out.getvalue())
Beispiel #8
0
 def test_show_not_found(self, name, namespace, text):
     with utils.StdOutCapture() as out:
         plugin_cmd.PluginCommands().show(None, name, namespace)
         self.assertEqual(text, out.getvalue())
Beispiel #9
0
    def test_list_not_found(self, name, namespace, text):

        with utils.StdOutCapture() as out:
            plugin_cmd.PluginCommands().list(name, namespace)
            self.assertEqual(out.getvalue(), text)