summaryrefslogtreecommitdiff
path: root/saharaclient/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-12-01 09:48:58 +0000
committerGerrit Code Review <review@openstack.org>2015-12-01 09:48:58 +0000
commita109193fa7eca73f6b0c57cbde8db84aaf588be1 (patch)
tree5fd97ea4f1e534d4a1dc8400309eb2603458d0cf /saharaclient/tests
parent39985d1b67a5779cf91422bf1ecddd074a10ba15 (diff)
parent9506964d321bc50433503d8e92a753c7c769a8f2 (diff)
downloadpython-saharaclient-a109193fa7eca73f6b0c57cbde8db84aaf588be1.tar.gz
Merge "Adding ability to get plugin processes via CLI"
Diffstat (limited to 'saharaclient/tests')
-rw-r--r--saharaclient/tests/unit/osc/v1/test_plugins.py42
1 files changed, 36 insertions, 6 deletions
diff --git a/saharaclient/tests/unit/osc/v1/test_plugins.py b/saharaclient/tests/unit/osc/v1/test_plugins.py
index 1f222eb..05f9e38 100644
--- a/saharaclient/tests/unit/osc/v1/test_plugins.py
+++ b/saharaclient/tests/unit/osc/v1/test_plugins.py
@@ -23,7 +23,12 @@ from saharaclient.tests.unit.osc.v1 import fakes
PLUGIN_INFO = {'name': 'fake',
'title': 'Fake Plugin',
'versions': ['0.1', '0.2'],
- 'description': 'Plugin for tests'}
+ 'description': 'Plugin for tests',
+ 'required_image_tags': ['fake', '0.1'],
+ 'node_processes': {
+ 'HDFS': ['datanode', 'namenode'],
+ 'MapReduce': ['jobtracker', 'tasktracker']
+ }}
class TestPlugins(fakes.TestDataProcessing):
@@ -81,29 +86,54 @@ class TestShowPlugin(TestPlugins):
super(TestShowPlugin, self).setUp()
self.plugins_mock.get.return_value = api_plugins.Plugin(
None, PLUGIN_INFO)
+ self.plugins_mock.get_version_details.return_value = (
+ api_plugins.Plugin(None, PLUGIN_INFO))
# Command to test
self.cmd = osc_plugins.ShowPlugin(self.app, None)
def test_plugin_show(self):
arglist = ['fake']
- verifylist = []
+ verifylist = [('plugin', 'fake')]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args)
- # Check that correct arguments was passed
+ # Check that correct arguments were passed
self.plugins_mock.get.assert_called_once_with('fake')
# Check that columns are correct
- expected_columns = ('description', 'name', 'title', 'versions')
+ expected_columns = ('Description', 'Name', 'Title', 'Versions')
self.assertEqual(expected_columns, columns)
# Check that data is correct
expected_data = ('Plugin for tests', 'fake', 'Fake Plugin', '0.1, 0.2')
self.assertEqual(expected_data, data)
+ def test_plugin_version_show(self):
+ arglist = ['fake', '--version', '0.1']
+ verifylist = [('plugin', 'fake'), ('version', '0.1')]
+
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+
+ columns, data = self.cmd.take_action(parsed_args)
+
+ # Check that correct arguments were passed
+ self.plugins_mock.get_version_details.assert_called_once_with(
+ 'fake', '0.1')
+
+ # Check that columns are correct
+ expected_columns = ('Description', 'Name', 'Required image tags',
+ 'Title', '', 'Service:', '', 'HDFS', 'MapReduce')
+ self.assertEqual(expected_columns, columns)
+
+ # Check that data is correct
+ expected_data = ('Plugin for tests', 'fake', '0.1, fake',
+ 'Fake Plugin', '', 'Available processes:', '',
+ 'datanode, namenode', 'jobtracker, tasktracker')
+ self.assertEqual(expected_data, data)
+
class TestGetPluginConfigs(TestPlugins):
def setUp(self):
@@ -125,7 +155,7 @@ class TestGetPluginConfigs(TestPlugins):
self.cmd.take_action(parsed_args)
- # Check that correct arguments was passed
+ # Check that correct arguments were passed
self.plugins_mock.get_version_details.assert_called_once_with(
'fake', '0.1')
@@ -148,7 +178,7 @@ class TestGetPluginConfigs(TestPlugins):
self.cmd.take_action(parsed_args)
- # Check that correct arguments was passed
+ # Check that correct arguments were passed
self.plugins_mock.get_version_details.assert_called_once_with(
'fake', '0.1')