summaryrefslogtreecommitdiff
path: root/openstackclient/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-03-14 20:17:04 +0000
committerGerrit Code Review <review@openstack.org>2016-03-14 20:17:04 +0000
commit006d34fc8257cb8519a427926d6edc5e965593cc (patch)
tree15980963542b27f9b0e3c63ac74677017f34f545 /openstackclient/tests
parent9447a0e2c7b3f002589f7fe56ae9e13ba11b6222 (diff)
parent8664a2f8aecd3d91a929e7e2b76772cae20f41e1 (diff)
downloadpython-openstackclient-006d34fc8257cb8519a427926d6edc5e965593cc.tar.gz
Merge "Support "--long" option in ListService"
Diffstat (limited to 'openstackclient/tests')
-rw-r--r--openstackclient/tests/compute/v2/fakes.py2
-rw-r--r--openstackclient/tests/compute/v2/test_service.py26
2 files changed, 27 insertions, 1 deletions
diff --git a/openstackclient/tests/compute/v2/fakes.py b/openstackclient/tests/compute/v2/fakes.py
index 26d3a283..ccd8cc6b 100644
--- a/openstackclient/tests/compute/v2/fakes.py
+++ b/openstackclient/tests/compute/v2/fakes.py
@@ -79,10 +79,12 @@ QUOTA_data = tuple(QUOTA[x] for x in sorted(QUOTA))
service_host = 'host_test'
service_binary = 'compute_test'
service_status = 'enabled'
+service_disabled_reason = 'earthquake'
SERVICE = {
'host': service_host,
'binary': service_binary,
'status': service_status,
+ 'disabled_reason': service_disabled_reason,
}
diff --git a/openstackclient/tests/compute/v2/test_service.py b/openstackclient/tests/compute/v2/test_service.py
index 0246fbc8..2feaf156 100644
--- a/openstackclient/tests/compute/v2/test_service.py
+++ b/openstackclient/tests/compute/v2/test_service.py
@@ -85,13 +85,37 @@ class TestServiceList(TestService):
# In base command class Lister in cliff, abstract method take_action()
# returns a tuple containing the column names and an iterable
# containing the data to be listed.
- self.cmd.take_action(parsed_args)
+ columns, data = self.cmd.take_action(parsed_args)
self.service_mock.list.assert_called_with(
compute_fakes.service_host,
compute_fakes.service_binary,
)
+ self.assertNotIn("Disabled Reason", columns)
+ self.assertNotIn(compute_fakes.service_disabled_reason, list(data)[0])
+
+ def test_service_list_with_long_option(self):
+ arglist = [
+ '--host', compute_fakes.service_host,
+ '--service', compute_fakes.service_binary,
+ '--long'
+ ]
+ verifylist = [
+ ('host', compute_fakes.service_host),
+ ('service', compute_fakes.service_binary),
+ ('long', True)
+ ]
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+
+ # In base command class Lister in cliff, abstract method take_action()
+ # returns a tuple containing the column names and an iterable
+ # containing the data to be listed.
+ columns, data = self.cmd.take_action(parsed_args)
+
+ self.assertIn("Disabled Reason", columns)
+ self.assertIn(compute_fakes.service_disabled_reason, list(data)[0])
+
class TestServiceSet(TestService):