summaryrefslogtreecommitdiff
path: root/openstackclient
diff options
context:
space:
mode:
Diffstat (limited to 'openstackclient')
-rw-r--r--openstackclient/compute/v2/server.py28
-rw-r--r--openstackclient/object/v1/container.py14
-rw-r--r--openstackclient/tests/common/test_availability_zone.py20
-rw-r--r--openstackclient/tests/common/test_extension.py12
-rw-r--r--openstackclient/tests/common/test_module.py12
-rw-r--r--openstackclient/tests/common/test_timing.py8
-rw-r--r--openstackclient/tests/compute/v2/fakes.py88
-rw-r--r--openstackclient/tests/compute/v2/test_flavor.py20
-rw-r--r--openstackclient/tests/compute/v2/test_hypervisor.py220
-rw-r--r--openstackclient/tests/compute/v2/test_security_group.py23
-rw-r--r--openstackclient/tests/compute/v2/test_security_group_rule.py41
-rw-r--r--openstackclient/tests/compute/v2/test_server.py49
-rw-r--r--openstackclient/tests/compute/v2/test_service.py5
-rw-r--r--openstackclient/tests/image/v1/test_image.py45
-rw-r--r--openstackclient/tests/image/v2/test_image.py65
-rw-r--r--openstackclient/tests/network/v2/test_network.py12
-rw-r--r--openstackclient/tests/network/v2/test_router.py8
-rw-r--r--openstackclient/tests/object/v1/test_container.py118
-rw-r--r--openstackclient/tests/object/v1/test_container_all.py12
-rw-r--r--openstackclient/tests/object/v1/test_object.py36
-rw-r--r--openstackclient/tests/object/v1/test_object_all.py8
-rw-r--r--openstackclient/tests/volume/v1/test_volume.py32
-rw-r--r--openstackclient/tests/volume/v2/test_volume.py28
23 files changed, 760 insertions, 144 deletions
diff --git a/openstackclient/compute/v2/server.py b/openstackclient/compute/v2/server.py
index dd7bc470..4cb94822 100644
--- a/openstackclient/compute/v2/server.py
+++ b/openstackclient/compute/v2/server.py
@@ -542,6 +542,34 @@ class CreateServer(command.ShowOne):
return zip(*sorted(six.iteritems(details)))
+class CreateServerDump(command.Command):
+ """Create a dump file in server(s)
+
+ Trigger crash dump in server(s) with features like kdump in Linux.
+ It will create a dump file in the server(s) dumping the server(s)'
+ memory, and also crash the server(s). OSC sees the dump file
+ (server dump) as a kind of resource.
+ """
+
+ def get_parser(self, prog_name):
+ parser = super(CreateServerDump, self).get_parser(prog_name)
+ parser.add_argument(
+ 'server',
+ metavar='<server>',
+ nargs='+',
+ help=_('Server(s) to create dump file (name or ID)'),
+ )
+ return parser
+
+ def take_action(self, parsed_args):
+ compute_client = self.app.client_manager.compute
+ for server in parsed_args.server:
+ utils.find_resource(
+ compute_client.servers,
+ server,
+ ).trigger_crash_dump()
+
+
class CreateServerImage(command.ShowOne):
"""Create a new disk image from a running server"""
diff --git a/openstackclient/object/v1/container.py b/openstackclient/object/v1/container.py
index e70afd9d..80b84238 100644
--- a/openstackclient/object/v1/container.py
+++ b/openstackclient/object/v1/container.py
@@ -59,6 +59,12 @@ class DeleteContainer(command.Command):
def get_parser(self, prog_name):
parser = super(DeleteContainer, self).get_parser(prog_name)
parser.add_argument(
+ '--recursive', '-r',
+ action='store_true',
+ default=False,
+ help='Recursively delete objects and container',
+ )
+ parser.add_argument(
'containers',
metavar='<container>',
nargs="+",
@@ -69,6 +75,14 @@ class DeleteContainer(command.Command):
def take_action(self, parsed_args):
for container in parsed_args.containers:
+ if parsed_args.recursive:
+ objs = self.app.client_manager.object_store.object_list(
+ container=container)
+ for obj in objs:
+ self.app.client_manager.object_store.object_delete(
+ container=container,
+ object=obj['name'],
+ )
self.app.client_manager.object_store.container_delete(
container=container,
)
diff --git a/openstackclient/tests/common/test_availability_zone.py b/openstackclient/tests/common/test_availability_zone.py
index e44455c7..feecaf55 100644
--- a/openstackclient/tests/common/test_availability_zone.py
+++ b/openstackclient/tests/common/test_availability_zone.py
@@ -144,7 +144,9 @@ class TestAvailabilityZoneList(TestAvailabilityZone):
verifylist = []
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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.compute_azs_mock.list.assert_called_with()
@@ -170,7 +172,9 @@ class TestAvailabilityZoneList(TestAvailabilityZone):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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.compute_azs_mock.list.assert_called_with()
@@ -199,7 +203,9 @@ class TestAvailabilityZoneList(TestAvailabilityZone):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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.compute_azs_mock.list.assert_called_with()
@@ -221,7 +227,9 @@ class TestAvailabilityZoneList(TestAvailabilityZone):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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.compute_azs_mock.list.assert_not_called()
@@ -243,7 +251,9 @@ class TestAvailabilityZoneList(TestAvailabilityZone):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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.compute_azs_mock.list.assert_not_called()
diff --git a/openstackclient/tests/common/test_extension.py b/openstackclient/tests/common/test_extension.py
index 21c2cc24..66532827 100644
--- a/openstackclient/tests/common/test_extension.py
+++ b/openstackclient/tests/common/test_extension.py
@@ -63,7 +63,9 @@ class TestExtensionList(TestExtension):
verifylist = []
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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)
# no args should output from all services
@@ -93,7 +95,9 @@ class TestExtensionList(TestExtension):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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)
# no args should output from all services
@@ -131,7 +135,9 @@ class TestExtensionList(TestExtension):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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.identity_extensions_mock.list.assert_called_with()
diff --git a/openstackclient/tests/common/test_module.py b/openstackclient/tests/common/test_module.py
index 6918c1b4..2821da9e 100644
--- a/openstackclient/tests/common/test_module.py
+++ b/openstackclient/tests/common/test_module.py
@@ -62,7 +62,9 @@ class TestCommandList(utils.TestCommand):
verifylist = []
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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)
collist = ('Command Group', 'Commands')
@@ -94,7 +96,9 @@ class TestModuleList(utils.TestCommand):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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)
# Additional modules may be present, just check our additions
@@ -110,7 +114,9 @@ class TestModuleList(utils.TestCommand):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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)
# Additional modules may be present, just check our additions
diff --git a/openstackclient/tests/common/test_timing.py b/openstackclient/tests/common/test_timing.py
index e7b9a040..c4c738b2 100644
--- a/openstackclient/tests/common/test_timing.py
+++ b/openstackclient/tests/common/test_timing.py
@@ -61,7 +61,9 @@ class TestTiming(utils.TestCommand):
verifylist = []
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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.assertEqual(self.columns, columns)
@@ -80,7 +82,9 @@ class TestTiming(utils.TestCommand):
verifylist = []
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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.assertEqual(self.columns, columns)
datalist = [
diff --git a/openstackclient/tests/compute/v2/fakes.py b/openstackclient/tests/compute/v2/fakes.py
index a90c9ee7..68a66740 100644
--- a/openstackclient/tests/compute/v2/fakes.py
+++ b/openstackclient/tests/compute/v2/fakes.py
@@ -88,25 +88,46 @@ SERVICE = {
class FakeComputev2Client(object):
def __init__(self, **kwargs):
+ self.aggregates = mock.Mock()
+ self.aggregates.resource_class = fakes.FakeResource(None, {})
self.availability_zones = mock.Mock()
self.availability_zones.resource_class = fakes.FakeResource(None, {})
+
self.images = mock.Mock()
self.images.resource_class = fakes.FakeResource(None, {})
+
self.servers = mock.Mock()
self.servers.resource_class = fakes.FakeResource(None, {})
+
self.services = mock.Mock()
self.services.resource_class = fakes.FakeResource(None, {})
+
self.extensions = mock.Mock()
self.extensions.resource_class = fakes.FakeResource(None, {})
+
self.flavors = mock.Mock()
self.flavors.resource_class = fakes.FakeResource(None, {})
+
self.quotas = mock.Mock()
self.quotas.resource_class = fakes.FakeResource(None, {})
+
self.quota_classes = mock.Mock()
self.quota_classes.resource_class = fakes.FakeResource(None, {})
+
self.volumes = mock.Mock()
self.volumes.resource_class = fakes.FakeResource(None, {})
+
+ self.hypervisors = mock.Mock()
+ self.hypervisors.resource_class = fakes.FakeResource(None, {})
+
+ self.security_groups = mock.Mock()
+ self.security_groups.resource_class = fakes.FakeResource(None, {})
+
+ self.security_group_rules = mock.Mock()
+ self.security_group_rules.resource_class = fakes.FakeResource(None, {})
+
self.auth_token = kwargs['token']
+
self.management_url = kwargs['endpoint']
@@ -140,6 +161,73 @@ class TestComputev2(utils.TestCommand):
)
+class FakeHypervisor(object):
+ """Fake one or more hypervisor."""
+
+ @staticmethod
+ def create_one_hypervisor(attrs={}):
+ """Create a fake hypervisor.
+
+ :param Dictionary attrs:
+ A dictionary with all attributes
+ :return:
+ A FakeResource object, with id, hypervisor_hostname, and so on
+ """
+ # Set default attributes.
+ hypervisor_info = {
+ 'id': 'hypervisor-id-' + uuid.uuid4().hex,
+ 'hypervisor_hostname': 'hypervisor-hostname-' + uuid.uuid4().hex,
+ 'status': 'enabled',
+ 'host_ip': '192.168.0.10',
+ 'cpu_info': {
+ 'aaa': 'aaa',
+ },
+ 'free_disk_gb': 50,
+ 'hypervisor_version': 2004001,
+ 'disk_available_least': 50,
+ 'local_gb': 50,
+ 'free_ram_mb': 1024,
+ 'service': {
+ 'host': 'aaa',
+ 'disabled_reason': None,
+ 'id': 1,
+ },
+ 'vcpus_used': 0,
+ 'hypervisor_type': 'QEMU',
+ 'local_gb_used': 0,
+ 'vcpus': 4,
+ 'memory_mb_used': 512,
+ 'memory_mb': 1024,
+ 'current_workload': 0,
+ 'state': 'up',
+ 'running_vms': 0,
+ }
+
+ # Overwrite default attributes.
+ hypervisor_info.update(attrs)
+
+ hypervisor = fakes.FakeResource(info=copy.deepcopy(hypervisor_info),
+ loaded=True)
+ return hypervisor
+
+ @staticmethod
+ def create_hypervisors(attrs={}, count=2):
+ """Create multiple fake hypervisors.
+
+ :param Dictionary attrs:
+ A dictionary with all attributes
+ :param int count:
+ The number of hypervisors to fake
+ :return:
+ A list of FakeResource objects faking the hypervisors
+ """
+ hypervisors = []
+ for i in range(0, count):
+ hypervisors.append(FakeHypervisor.create_one_hypervisor(attrs))
+
+ return hypervisors
+
+
class FakeServer(object):
"""Fake one or more compute servers."""
diff --git a/openstackclient/tests/compute/v2/test_flavor.py b/openstackclient/tests/compute/v2/test_flavor.py
index 3a59020c..bf78bee8 100644
--- a/openstackclient/tests/compute/v2/test_flavor.py
+++ b/openstackclient/tests/compute/v2/test_flavor.py
@@ -126,7 +126,9 @@ class TestFlavorList(TestFlavor):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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)
# Set expected values
@@ -153,7 +155,9 @@ class TestFlavorList(TestFlavor):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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)
# Set expected values
@@ -180,7 +184,9 @@ class TestFlavorList(TestFlavor):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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)
# Set expected values
@@ -207,7 +213,9 @@ class TestFlavorList(TestFlavor):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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)
# Set expected values
@@ -234,7 +242,9 @@ class TestFlavorList(TestFlavor):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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)
# Set expected values
diff --git a/openstackclient/tests/compute/v2/test_hypervisor.py b/openstackclient/tests/compute/v2/test_hypervisor.py
new file mode 100644
index 00000000..8d717ba7
--- /dev/null
+++ b/openstackclient/tests/compute/v2/test_hypervisor.py
@@ -0,0 +1,220 @@
+# Copyright 2016 EasyStack Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+
+import copy
+
+from openstackclient.common import exceptions
+from openstackclient.compute.v2 import hypervisor
+from openstackclient.tests.compute.v2 import fakes as compute_fakes
+from openstackclient.tests import fakes
+
+
+class TestHypervisor(compute_fakes.TestComputev2):
+
+ def setUp(self):
+ super(TestHypervisor, self).setUp()
+
+ # Get a shortcut to the compute client hypervisors mock
+ self.hypervisors_mock = self.app.client_manager.compute.hypervisors
+ self.hypervisors_mock.reset_mock()
+
+ # Get a shortcut to the compute client aggregates mock
+ self.aggregates_mock = self.app.client_manager.compute.aggregates
+ self.aggregates_mock.reset_mock()
+
+
+class TestHypervisorList(TestHypervisor):
+
+ def setUp(self):
+ super(TestHypervisorList, self).setUp()
+
+ # Fake hypervisors to be listed up
+ self.hypervisors = compute_fakes.FakeHypervisor.create_hypervisors()
+ self.hypervisors_mock.list.return_value = self.hypervisors
+
+ self.columns = (
+ "ID",
+ "Hypervisor Hostname"
+ )
+ self.data = (
+ (
+ self.hypervisors[0].id,
+ self.hypervisors[0].hypervisor_hostname,
+ ),
+ (
+ self.hypervisors[1].id,
+ self.hypervisors[1].hypervisor_hostname,
+ ),
+ )
+
+ # Get the command object to test
+ self.cmd = hypervisor.ListHypervisor(self.app, None)
+
+ def test_hypervisor_list_no_option(self):
+ arglist = []
+ verifylist = []
+ 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.hypervisors_mock.list.assert_called_with()
+ self.assertEqual(self.columns, columns)
+ self.assertEqual(self.data, tuple(data))
+
+ def test_hypervisor_list_matching_option_found(self):
+ arglist = [
+ '--matching', self.hypervisors[0].hypervisor_hostname,
+ ]
+ verifylist = [
+ ('matching', self.hypervisors[0].hypervisor_hostname),
+ ]
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+
+ # Fake the return value of search()
+ self.hypervisors_mock.search.return_value = [self.hypervisors[0]]
+ self.data = (
+ (
+ self.hypervisors[0].id,
+ self.hypervisors[0].hypervisor_hostname,
+ ),
+ )
+
+ # 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.hypervisors_mock.search.assert_called_with(
+ self.hypervisors[0].hypervisor_hostname
+ )
+ self.assertEqual(self.columns, columns)
+ self.assertEqual(self.data, tuple(data))
+
+ def test_hypervisor_list_matching_option_not_found(self):
+ arglist = [
+ '--matching', 'xxx',
+ ]
+ verifylist = [
+ ('matching', 'xxx'),
+ ]
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+
+ # Fake exception raised from search()
+ self.hypervisors_mock.search.side_effect = exceptions.NotFound(None)
+
+ self.assertRaises(exceptions.NotFound,
+ self.cmd.take_action,
+ parsed_args)
+
+
+class TestHypervisorShow(TestHypervisor):
+
+ def setUp(self):
+ super(TestHypervisorShow, self).setUp()
+
+ # Fake hypervisors to be listed up
+ self.hypervisor = compute_fakes.FakeHypervisor.create_one_hypervisor()
+
+ # Return value of utils.find_resource()
+ self.hypervisors_mock.get.return_value = self.hypervisor
+
+ # Return value of compute_client.aggregates.list()
+ self.aggregates_mock.list.return_value = []
+
+ # Return value of compute_client.hypervisors.uptime()
+ uptime_info = {
+ 'status': self.hypervisor.status,
+ 'state': self.hypervisor.state,
+ 'id': self.hypervisor.id,
+ 'hypervisor_hostname': self.hypervisor.hypervisor_hostname,
+ 'uptime': ' 01:28:24 up 3 days, 11:15, 1 user, '
+ ' load average: 0.94, 0.62, 0.50\n',
+ }
+ self.hypervisors_mock.uptime.return_value = fakes.FakeResource(
+ info=copy.deepcopy(uptime_info),
+ loaded=True
+ )
+
+ self.columns = (
+ 'aggregates',
+ 'cpu_info',
+ 'current_workload',
+ 'disk_available_least',
+ 'free_disk_gb',
+ 'free_ram_mb',
+ 'host_ip',
+ 'hypervisor_hostname',
+ 'hypervisor_type',
+ 'hypervisor_version',
+ 'id',
+ 'local_gb',
+ 'local_gb_used',
+ 'memory_mb',
+ 'memory_mb_used',
+ 'running_vms',
+ 'service_host',
+ 'service_id',
+ 'state',
+ 'status',
+ 'vcpus',
+ 'vcpus_used',
+ )
+ self.data = (
+ [],
+ {'aaa': 'aaa'},
+ 0,
+ 50,
+ 50,
+ 1024,
+ '192.168.0.10',
+ self.hypervisor.hypervisor_hostname,
+ 'QEMU',
+ 2004001,
+ self.hypervisor.id,
+ 50,
+ 0,
+ 1024,
+ 512,
+ 0,
+ 'aaa',
+ 1,
+ 'up',
+ 'enabled',
+ 4,
+ 0,
+ )
+
+ # Get the command object to test
+ self.cmd = hypervisor.ShowHypervisor(self.app, None)
+
+ def test_hypervisor_show(self):
+ arglist = [
+ self.hypervisor.hypervisor_hostname,
+ ]
+ verifylist = [
+ ('hypervisor', self.hypervisor.hypervisor_hostname),
+ ]
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
+ columns, data = self.cmd.take_action(parsed_args)
+
+ self.assertEqual(self.columns, columns)
+ self.assertEqual(self.data, data)
diff --git a/openstackclient/tests/compute/v2/test_security_group.py b/openstackclient/tests/compute/v2/test_security_group.py
index 87cc4870..c6998cb5 100644
--- a/openstackclient/tests/compute/v2/test_security_group.py
+++ b/openstackclient/tests/compute/v2/test_security_group.py
@@ -12,7 +12,6 @@
#
import copy
-import mock
from openstackclient.compute.v2 import security_group
from openstackclient.tests.compute.v2 import fakes as compute_fakes
@@ -43,14 +42,12 @@ class TestSecurityGroup(compute_fakes.TestComputev2):
def setUp(self):
super(TestSecurityGroup, self).setUp()
- self.secgroups_mock = mock.Mock()
- self.secgroups_mock.resource_class = fakes.FakeResource(None, {})
- self.app.client_manager.compute.security_groups = self.secgroups_mock
+ # Get a shortcut compute client security_groups mock
+ self.secgroups_mock = self.app.client_manager.compute.security_groups
self.secgroups_mock.reset_mock()
- self.projects_mock = mock.Mock()
- self.projects_mock.resource_class = fakes.FakeResource(None, {})
- self.app.client_manager.identity.projects = self.projects_mock
+ # Get a shortcut identity client projects mock
+ self.projects_mock = self.app.client_manager.identity.projects
self.projects_mock.reset_mock()
@@ -90,7 +87,9 @@ class TestSecurityGroupCreate(TestSecurityGroup):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# SecurityGroupManager.create(name, description)
@@ -113,7 +112,9 @@ class TestSecurityGroupCreate(TestSecurityGroup):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# SecurityGroupManager.create(name, description)
@@ -158,7 +159,9 @@ class TestSecurityGroupList(TestSecurityGroup):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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)
# Set expected values
diff --git a/openstackclient/tests/compute/v2/test_security_group_rule.py b/openstackclient/tests/compute/v2/test_security_group_rule.py
index a2f9b108..9a8003f3 100644
--- a/openstackclient/tests/compute/v2/test_security_group_rule.py
+++ b/openstackclient/tests/compute/v2/test_security_group_rule.py
@@ -12,7 +12,6 @@
#
import copy
-import mock
from openstackclient.compute.v2 import security_group
from openstackclient.tests.compute.v2 import fakes as compute_fakes
@@ -102,15 +101,13 @@ class TestSecurityGroupRule(compute_fakes.TestComputev2):
def setUp(self):
super(TestSecurityGroupRule, self).setUp()
- self.secgroups_mock = mock.Mock()
- self.secgroups_mock.resource_class = fakes.FakeResource(None, {})
- self.app.client_manager.compute.security_groups = self.secgroups_mock
+ # Get a shortcut compute client security_groups mock
+ self.secgroups_mock = self.app.client_manager.compute.security_groups
self.secgroups_mock.reset_mock()
- self.sg_rules_mock = mock.Mock()
- self.sg_rules_mock.resource_class = fakes.FakeResource(None, {})
- self.app.client_manager.compute.security_group_rules = \
- self.sg_rules_mock
+ # Get a shortcut compute client security_group_rules mock
+ self.sg_rules_mock = \
+ self.app.client_manager.compute.security_group_rules
self.sg_rules_mock.reset_mock()
@@ -152,7 +149,9 @@ class TestSecurityGroupRuleCreate(TestSecurityGroupRule):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# SecurityGroupManager.create(name, description)
@@ -196,7 +195,9 @@ class TestSecurityGroupRuleCreate(TestSecurityGroupRule):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# SecurityGroupManager.create(name, description)
@@ -244,7 +245,9 @@ class TestSecurityGroupRuleCreate(TestSecurityGroupRule):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# SecurityGroupManager.create(name, description)
@@ -287,7 +290,9 @@ class TestSecurityGroupRuleCreate(TestSecurityGroupRule):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# SecurityGroupManager.create(name, description)
@@ -333,7 +338,9 @@ class TestSecurityGroupRuleCreate(TestSecurityGroupRule):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# SecurityGroupManager.create(name, description)
@@ -404,7 +411,9 @@ class TestSecurityGroupRuleList(TestSecurityGroupRule):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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)
collist = (
@@ -440,7 +449,9 @@ class TestSecurityGroupRuleList(TestSecurityGroupRule):
parsed_args = self.check_parser(self.cmd, [], [])
- # DisplayCommandBase.take_action() returns two tuples
+ # 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)
collist = (
diff --git a/openstackclient/tests/compute/v2/test_server.py b/openstackclient/tests/compute/v2/test_server.py
index f6b62291..a80eaf51 100644
--- a/openstackclient/tests/compute/v2/test_server.py
+++ b/openstackclient/tests/compute/v2/test_server.py
@@ -79,7 +79,6 @@ class TestServer(compute_fakes.TestComputev2):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
for s in servers:
@@ -164,7 +163,9 @@ class TestServerCreate(TestServer):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# Set expected values
@@ -242,7 +243,9 @@ class TestServerCreate(TestServer):
self.app.client_manager.network.find_network = find_network
self.app.client_manager.network.find_port = find_port
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# Set expected values
@@ -300,7 +303,9 @@ class TestServerCreate(TestServer):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# Ensure the userdata file is opened
@@ -411,7 +416,6 @@ class TestServerDelete(TestServer):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
self.servers_mock.delete.assert_called_with(
@@ -431,7 +435,6 @@ class TestServerDelete(TestServer):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
calls = []
@@ -451,7 +454,6 @@ class TestServerDelete(TestServer):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
self.servers_mock.delete.assert_called_with(
@@ -476,7 +478,6 @@ class TestServerDelete(TestServer):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.assertRaises(SystemExit, self.cmd.take_action, parsed_args)
self.servers_mock.delete.assert_called_with(
@@ -490,6 +491,26 @@ class TestServerDelete(TestServer):
)
+class TestServerDumpCreate(TestServer):
+
+ def setUp(self):
+ super(TestServerDumpCreate, self).setUp()
+
+ # Get the command object to test
+ self.cmd = server.CreateServerDump(self.app, None)
+
+ # Set methods to be tested.
+ self.methods = {
+ 'trigger_crash_dump': None,
+ }
+
+ def test_server_dump_one_server(self):
+ self.run_method_with_servers('trigger_crash_dump', 1)
+
+ def test_server_dump_multi_servers(self):
+ self.run_method_with_servers('trigger_crash_dump', 3)
+
+
class TestServerImageCreate(TestServer):
columns = (
@@ -536,7 +557,9 @@ class TestServerImageCreate(TestServer):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# ServerManager.create_image(server, image_name, metadata=)
@@ -559,7 +582,9 @@ class TestServerImageCreate(TestServer):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# ServerManager.create_image(server, image_name, metadata=)
@@ -841,7 +866,6 @@ class TestServerResize(TestServer):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
self.servers_mock.get.assert_called_with(
@@ -865,7 +889,6 @@ class TestServerResize(TestServer):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
self.servers_mock.get.assert_called_with(
@@ -894,7 +917,6 @@ class TestServerResize(TestServer):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
self.servers_mock.get.assert_called_with(
@@ -919,7 +941,6 @@ class TestServerResize(TestServer):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
self.servers_mock.get.assert_called_with(
diff --git a/openstackclient/tests/compute/v2/test_service.py b/openstackclient/tests/compute/v2/test_service.py
index 380fbc4f..54adaab3 100644
--- a/openstackclient/tests/compute/v2/test_service.py
+++ b/openstackclient/tests/compute/v2/test_service.py
@@ -49,7 +49,6 @@ class TestServiceDelete(TestService):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
self.service_mock.delete.assert_called_with(
@@ -82,7 +81,9 @@ class TestServiceList(TestService):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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)
self.service_mock.list.assert_called_with(
diff --git a/openstackclient/tests/image/v1/test_image.py b/openstackclient/tests/image/v1/test_image.py
index 1e0b29aa..201105a4 100644
--- a/openstackclient/tests/image/v1/test_image.py
+++ b/openstackclient/tests/image/v1/test_image.py
@@ -73,7 +73,9 @@ class TestImageCreate(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# ImageManager.create(name=, **)
@@ -120,7 +122,9 @@ class TestImageCreate(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# ImageManager.create(name=, **)
@@ -172,7 +176,9 @@ class TestImageCreate(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# Ensure input file is opened
@@ -230,7 +236,6 @@ class TestImageDelete(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
self.images_mock.delete.assert_called_with(
@@ -274,7 +279,9 @@ class TestImageList(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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.api_mock.image_list.assert_called_with(
detailed=True,
@@ -295,7 +302,9 @@ class TestImageList(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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.api_mock.image_list.assert_called_with(
detailed=True,
@@ -317,7 +326,9 @@ class TestImageList(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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.api_mock.image_list.assert_called_with(
detailed=True,
@@ -337,7 +348,9 @@ class TestImageList(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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.api_mock.image_list.assert_called_with(
detailed=True,
@@ -386,7 +399,9 @@ class TestImageList(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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.api_mock.image_list.assert_called_with(
detailed=True,
@@ -412,7 +427,9 @@ class TestImageList(TestImage):
verifylist = [('sort', 'name:asc')]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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.api_mock.image_list.assert_called_with(
detailed=True,
@@ -456,7 +473,6 @@ class TestImageSet(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
# Verify update() was not called, if it was show the args
@@ -517,7 +533,6 @@ class TestImageSet(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
kwargs = {
@@ -545,7 +560,6 @@ class TestImageSet(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
kwargs = {
@@ -570,7 +584,6 @@ class TestImageSet(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
kwargs = {
@@ -669,7 +682,9 @@ class TestImageShow(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
self.images_mock.get.assert_called_with(
image_fakes.image_id,
diff --git a/openstackclient/tests/image/v2/test_image.py b/openstackclient/tests/image/v2/test_image.py
index d399c9ed..de37512f 100644
--- a/openstackclient/tests/image/v2/test_image.py
+++ b/openstackclient/tests/image/v2/test_image.py
@@ -95,7 +95,9 @@ class TestImageCreate(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# ImageManager.create(name=, **)
@@ -156,7 +158,9 @@ class TestImageCreate(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# ImageManager.create(name=, **)
@@ -288,7 +292,9 @@ class TestImageCreate(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# ImageManager.create(name=, **)
@@ -382,7 +388,9 @@ class TestAddProjectToImage(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
self.image_members_mock.create.assert_called_with(
image_fakes.image_id,
@@ -404,7 +412,9 @@ class TestAddProjectToImage(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
self.image_members_mock.create.assert_called_with(
image_fakes.image_id,
@@ -435,7 +445,6 @@ class TestImageDelete(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
self.images_mock.delete.assert_called_with(
@@ -496,7 +505,9 @@ class TestImageList(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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.api_mock.image_list.assert_called_with()
@@ -515,7 +526,9 @@ class TestImageList(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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.api_mock.image_list.assert_called_with(
public=True,
@@ -536,7 +549,9 @@ class TestImageList(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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.api_mock.image_list.assert_called_with(
private=True,
@@ -557,7 +572,9 @@ class TestImageList(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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.api_mock.image_list.assert_called_with(
shared=True,
@@ -575,7 +592,9 @@ class TestImageList(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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.api_mock.image_list.assert_called_with()
@@ -621,7 +640,9 @@ class TestImageList(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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.api_mock.image_list.assert_called_with()
sf_mock.assert_called_with(
@@ -644,7 +665,9 @@ class TestImageList(TestImage):
verifylist = [('sort', 'name:asc')]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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.api_mock.image_list.assert_called_with()
si_mock.assert_called_with(
@@ -730,7 +753,6 @@ class TestRemoveProjectImage(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
self.image_members_mock.delete.assert_called_with(
image_fakes.image_id,
@@ -750,7 +772,6 @@ class TestRemoveProjectImage(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
self.image_members_mock.delete.assert_called_with(
image_fakes.image_id,
@@ -808,7 +829,6 @@ class TestImageSet(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
kwargs = {
@@ -876,7 +896,6 @@ class TestImageSet(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
kwargs = {
@@ -904,7 +923,6 @@ class TestImageSet(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
kwargs = {
@@ -929,7 +947,6 @@ class TestImageSet(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
kwargs = {
@@ -963,7 +980,6 @@ class TestImageSet(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
kwargs = {
@@ -991,7 +1007,6 @@ class TestImageSet(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
kwargs = {
@@ -1015,7 +1030,6 @@ class TestImageSet(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
kwargs = {
@@ -1044,7 +1058,6 @@ class TestImageSet(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
kwargs = {
@@ -1075,7 +1088,6 @@ class TestImageSet(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
kwargs = {
@@ -1101,7 +1113,6 @@ class TestImageSet(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
kwargs = {
@@ -1155,7 +1166,9 @@ class TestImageShow(TestImage):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
self.images_mock.get.assert_called_with(
image_fakes.image_id,
diff --git a/openstackclient/tests/network/v2/test_network.py b/openstackclient/tests/network/v2/test_network.py
index f96497a4..9829d578 100644
--- a/openstackclient/tests/network/v2/test_network.py
+++ b/openstackclient/tests/network/v2/test_network.py
@@ -380,7 +380,9 @@ class TestListNetwork(TestNetwork):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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.network.networks.assert_called_with()
@@ -397,7 +399,9 @@ class TestListNetwork(TestNetwork):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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.network.networks.assert_called_with(
@@ -416,7 +420,9 @@ class TestListNetwork(TestNetwork):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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.network.networks.assert_called_with()
diff --git a/openstackclient/tests/network/v2/test_router.py b/openstackclient/tests/network/v2/test_router.py
index 98e9f17a..69c548a0 100644
--- a/openstackclient/tests/network/v2/test_router.py
+++ b/openstackclient/tests/network/v2/test_router.py
@@ -201,7 +201,9 @@ class TestListRouter(TestRouter):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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.network.routers.assert_called_with()
@@ -217,7 +219,9 @@ class TestListRouter(TestRouter):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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.network.routers.assert_called_with()
diff --git a/openstackclient/tests/object/v1/test_container.py b/openstackclient/tests/object/v1/test_container.py
index afcb3386..5b0fb48a 100644
--- a/openstackclient/tests/object/v1/test_container.py
+++ b/openstackclient/tests/object/v1/test_container.py
@@ -44,6 +44,96 @@ class TestContainer(object_fakes.TestObjectv1):
self.api = self.app.client_manager.object_store
+@mock.patch('openstackclient.api.object_store_v1.APIv1.object_delete')
+@mock.patch('openstackclient.api.object_store_v1.APIv1.object_list')
+@mock.patch('openstackclient.api.object_store_v1.APIv1.container_delete')
+class TestContainerDelete(TestContainer):
+
+ def setUp(self):
+ super(TestContainerDelete, self).setUp()
+
+ # Get the command object to test
+ self.cmd = container.DeleteContainer(self.app, None)
+
+ def test_container_delete(self, c_mock, o_list_mock, o_delete_mock):
+ c_mock.return_value = None
+
+ arglist = [
+ object_fakes.container_name,
+ ]
+ verifylist = [
+ ('containers', [object_fakes.container_name]),
+ ('recursive', False),
+ ]
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+
+ self.assertEqual(None, self.cmd.take_action(parsed_args))
+
+ kwargs = {}
+ c_mock.assert_called_with(
+ container=object_fakes.container_name,
+ **kwargs
+ )
+ self.assertFalse(o_list_mock.called)
+ self.assertFalse(o_delete_mock.called)
+
+ def test_recursive_delete(self, c_mock, o_list_mock, o_delete_mock):
+ c_mock.return_value = None
+ o_list_mock.return_value = [object_fakes.OBJECT]
+ o_delete_mock.return_value = None
+
+ arglist = [
+ '--recursive',
+ object_fakes.container_name,
+ ]
+ verifylist = [
+ ('containers', [object_fakes.container_name]),
+ ('recursive', True),
+ ]
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+
+ self.assertEqual(None, self.cmd.take_action(parsed_args))
+
+ kwargs = {}
+ c_mock.assert_called_with(
+ container=object_fakes.container_name,
+ **kwargs
+ )
+ o_list_mock.assert_called_with(container=object_fakes.container_name)
+ o_delete_mock.assert_called_with(
+ container=object_fakes.container_name,
+ object=object_fakes.OBJECT['name'],
+ )
+
+ def test_r_delete(self, c_mock, o_list_mock, o_delete_mock):
+ c_mock.return_value = None
+ o_list_mock.return_value = [object_fakes.OBJECT]
+ o_delete_mock.return_value = None
+
+ arglist = [
+ '-r',
+ object_fakes.container_name,
+ ]
+ verifylist = [
+ ('containers', [object_fakes.container_name]),
+ ('recursive', True),
+ ]
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+
+ self.assertEqual(None, self.cmd.take_action(parsed_args))
+
+ kwargs = {}
+ c_mock.assert_called_with(
+ container=object_fakes.container_name,
+ **kwargs
+ )
+ o_list_mock.assert_called_with(container=object_fakes.container_name)
+ o_delete_mock.assert_called_with(
+ container=object_fakes.container_name,
+ object=object_fakes.OBJECT['name'],
+ )
+
+
@mock.patch(
'openstackclient.api.object_store_v1.APIv1.container_list'
)
@@ -66,7 +156,9 @@ class TestContainerList(TestContainer):
verifylist = []
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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)
# Set expected values
@@ -98,7 +190,9 @@ class TestContainerList(TestContainer):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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)
# Set expected values
@@ -132,7 +226,9 @@ class TestContainerList(TestContainer):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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)
# Set expected values
@@ -165,7 +261,9 @@ class TestContainerList(TestContainer):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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)
# Set expected values
@@ -197,7 +295,9 @@ class TestContainerList(TestContainer):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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)
# Set expected values
@@ -238,7 +338,9 @@ class TestContainerList(TestContainer):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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)
# Set expected values
@@ -280,7 +382,9 @@ class TestContainerShow(TestContainer):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# Set expected values
diff --git a/openstackclient/tests/object/v1/test_container_all.py b/openstackclient/tests/object/v1/test_container_all.py
index c2dd02a5..95e12f47 100644
--- a/openstackclient/tests/object/v1/test_container_all.py
+++ b/openstackclient/tests/object/v1/test_container_all.py
@@ -57,7 +57,9 @@ class TestContainerCreate(TestContainerAll):
)]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
self.assertEqual(self.columns, columns)
@@ -91,7 +93,9 @@ class TestContainerCreate(TestContainerAll):
)]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
self.assertEqual(self.columns, columns)
@@ -312,7 +316,9 @@ class TestContainerShow(TestContainerAll):
)]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
collist = (
diff --git a/openstackclient/tests/object/v1/test_object.py b/openstackclient/tests/object/v1/test_object.py
index f0d62f6e..990e4f46 100644
--- a/openstackclient/tests/object/v1/test_object.py
+++ b/openstackclient/tests/object/v1/test_object.py
@@ -67,7 +67,9 @@ class TestObjectList(TestObject):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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)
o_mock.assert_called_with(
@@ -96,7 +98,9 @@ class TestObjectList(TestObject):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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)
# Set expected values
@@ -126,7 +130,9 @@ class TestObjectList(TestObject):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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)
# Set expected values
@@ -156,7 +162,9 @@ class TestObjectList(TestObject):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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)
# Set expected values
@@ -186,7 +194,9 @@ class TestObjectList(TestObject):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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)
# Set expected values
@@ -216,7 +226,9 @@ class TestObjectList(TestObject):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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)
# Set expected values
@@ -247,7 +259,9 @@ class TestObjectList(TestObject):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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)
# Set expected values
@@ -294,7 +308,9 @@ class TestObjectList(TestObject):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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)
# Set expected values
@@ -338,7 +354,9 @@ class TestObjectShow(TestObject):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# Set expected values
diff --git a/openstackclient/tests/object/v1/test_object_all.py b/openstackclient/tests/object/v1/test_object_all.py
index a90e5b65..89286b00 100644
--- a/openstackclient/tests/object/v1/test_object_all.py
+++ b/openstackclient/tests/object/v1/test_object_all.py
@@ -102,7 +102,9 @@ class TestObjectList(TestObjectAll):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # 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.assertEqual(self.columns, columns)
@@ -150,7 +152,9 @@ class TestObjectShow(TestObjectAll):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
collist = (
diff --git a/openstackclient/tests/volume/v1/test_volume.py b/openstackclient/tests/volume/v1/test_volume.py
index 33255aac..00c509b5 100644
--- a/openstackclient/tests/volume/v1/test_volume.py
+++ b/openstackclient/tests/volume/v1/test_volume.py
@@ -95,7 +95,9 @@ class TestVolumeCreate(TestVolume):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# VolumeManager.create(size, snapshot_id=, source_volid=,
@@ -136,7 +138,9 @@ class TestVolumeCreate(TestVolume):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# VolumeManager.create(size, snapshot_id=, source_volid=,
@@ -189,7 +193,9 @@ class TestVolumeCreate(TestVolume):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# VolumeManager.create(size, snapshot_id=, source_volid=,
@@ -242,7 +248,9 @@ class TestVolumeCreate(TestVolume):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# VolumeManager.create(size, snapshot_id=, source_volid=,
@@ -281,7 +289,9 @@ class TestVolumeCreate(TestVolume):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# VolumeManager.create(size, snapshot_id=, source_volid=,
@@ -325,7 +335,9 @@ class TestVolumeCreate(TestVolume):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# VolumeManager.create(size, snapshot_id=, source_volid=,
@@ -369,7 +381,9 @@ class TestVolumeCreate(TestVolume):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
# VolumeManager.create(size, snapshot_id=, source_volid=,
@@ -582,7 +596,6 @@ class TestVolumeSet(TestVolume):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
# Set expected values
@@ -608,7 +621,6 @@ class TestVolumeSet(TestVolume):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
# Set expected values
@@ -634,7 +646,6 @@ class TestVolumeSet(TestVolume):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
# Set expected values
@@ -700,7 +711,6 @@ class TestVolumeSet(TestVolume):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
# Set expected values
diff --git a/openstackclient/tests/volume/v2/test_volume.py b/openstackclient/tests/volume/v2/test_volume.py
index 76c7a27a..df43cb2b 100644
--- a/openstackclient/tests/volume/v2/test_volume.py
+++ b/openstackclient/tests/volume/v2/test_volume.py
@@ -96,7 +96,9 @@ class TestVolumeCreate(TestVolume):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
self.volumes_mock.create.assert_called_with(
@@ -133,7 +135,9 @@ class TestVolumeCreate(TestVolume):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
self.volumes_mock.create.assert_called_with(
@@ -181,7 +185,9 @@ class TestVolumeCreate(TestVolume):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
self.volumes_mock.create.assert_called_with(
@@ -229,7 +235,9 @@ class TestVolumeCreate(TestVolume):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
self.volumes_mock.create.assert_called_with(
@@ -263,7 +271,9 @@ class TestVolumeCreate(TestVolume):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
self.volumes_mock.create.assert_called_with(
@@ -302,7 +312,9 @@ class TestVolumeCreate(TestVolume):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
self.volumes_mock.create.assert_called_with(
@@ -341,7 +353,9 @@ class TestVolumeCreate(TestVolume):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns a two-part tuple with a tuple of column names and a tuple of
+ # data to be shown.
columns, data = self.cmd.take_action(parsed_args)
self.volumes_mock.create.assert_called_with(