summaryrefslogtreecommitdiff
path: root/openstackclient
diff options
context:
space:
mode:
Diffstat (limited to 'openstackclient')
-rw-r--r--openstackclient/common/logs.py46
-rw-r--r--openstackclient/compute/v2/floatingip.py40
-rw-r--r--openstackclient/identity/v3/role_assignment.py40
-rw-r--r--openstackclient/identity/v3/token.py19
-rw-r--r--openstackclient/network/common.py102
-rw-r--r--openstackclient/network/v2/floating_ip.py66
-rw-r--r--openstackclient/network/v2/network.py25
-rw-r--r--openstackclient/shell.py13
-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.py86
-rw-r--r--openstackclient/tests/compute/v2/test_flavor.py10
-rw-r--r--openstackclient/tests/compute/v2/test_hypervisor.py6
-rw-r--r--openstackclient/tests/compute/v2/test_security_group.py6
-rw-r--r--openstackclient/tests/compute/v2/test_security_group_rule.py14
-rw-r--r--openstackclient/tests/compute/v2/test_server.py19
-rw-r--r--openstackclient/tests/compute/v2/test_service.py2
-rw-r--r--openstackclient/tests/identity/v2_0/test_catalog.py12
-rw-r--r--openstackclient/tests/identity/v2_0/test_endpoint.py17
-rw-r--r--openstackclient/tests/identity/v2_0/test_project.py40
-rw-r--r--openstackclient/tests/identity/v2_0/test_role.py34
-rw-r--r--openstackclient/tests/identity/v2_0/test_service.py29
-rw-r--r--openstackclient/tests/identity/v2_0/test_token.py4
-rw-r--r--openstackclient/tests/identity/v2_0/test_user.py60
-rw-r--r--openstackclient/tests/identity/v3/fakes.py31
-rw-r--r--openstackclient/tests/identity/v3/test_catalog.py8
-rw-r--r--openstackclient/tests/identity/v3/test_consumer.py4
-rw-r--r--openstackclient/tests/identity/v3/test_domain.py24
-rw-r--r--openstackclient/tests/identity/v3/test_endpoint.py36
-rw-r--r--openstackclient/tests/identity/v3/test_group.py16
-rw-r--r--openstackclient/tests/identity/v3/test_identity_provider.py4
-rw-r--r--openstackclient/tests/identity/v3/test_project.py40
-rw-r--r--openstackclient/tests/identity/v3/test_region.py24
-rw-r--r--openstackclient/tests/identity/v3/test_role.py42
-rw-r--r--openstackclient/tests/identity/v3/test_role_assignment.py124
-rw-r--r--openstackclient/tests/identity/v3/test_service.py28
-rw-r--r--openstackclient/tests/identity/v3/test_service_provider.py4
-rw-r--r--openstackclient/tests/identity/v3/test_token.py29
-rw-r--r--openstackclient/tests/identity/v3/test_trust.py12
-rw-r--r--openstackclient/tests/identity/v3/test_unscoped_saml.py8
-rw-r--r--openstackclient/tests/identity/v3/test_user.py69
-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/test_common.py118
-rw-r--r--openstackclient/tests/network/v2/fakes.py80
-rw-r--r--openstackclient/tests/network/v2/test_floating_ip.py181
-rw-r--r--openstackclient/tests/network/v2/test_network.py85
-rw-r--r--openstackclient/tests/network/v2/test_router.py31
-rw-r--r--openstackclient/tests/object/v1/test_container.py28
-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
56 files changed, 1577 insertions, 417 deletions
diff --git a/openstackclient/common/logs.py b/openstackclient/common/logs.py
index 6d1aec13..7ad6e832 100644
--- a/openstackclient/common/logs.py
+++ b/openstackclient/common/logs.py
@@ -18,6 +18,13 @@ import sys
import warnings
+def get_loggers():
+ loggers = {}
+ for logkey in logging.Logger.manager.loggerDict.keys():
+ loggers[logkey] = logging.getLevelName(logging.getLogger(logkey).level)
+ return loggers
+
+
def log_level_from_options(options):
# if --debug, --quiet or --verbose is not specified,
# the default logging level is warning
@@ -34,6 +41,17 @@ def log_level_from_options(options):
return log_level
+def log_level_from_string(level_string):
+ log_level = {
+ 'critical': logging.CRITICAL,
+ 'error': logging.ERROR,
+ 'warning': logging.WARNING,
+ 'info': logging.INFO,
+ 'debug': logging.DEBUG,
+ }.get(level_string, logging.WARNING)
+ return log_level
+
+
def log_level_from_config(config):
# Check the command line option
verbose_level = config.get('verbose_level')
@@ -49,15 +67,7 @@ def log_level_from_config(config):
verbose_level = 'info'
else:
verbose_level = 'debug'
-
- log_level = {
- 'critical': logging.CRITICAL,
- 'error': logging.ERROR,
- 'warning': logging.WARNING,
- 'info': logging.INFO,
- 'debug': logging.DEBUG,
- }.get(verbose_level, logging.WARNING)
- return log_level
+ return log_level_from_string(verbose_level)
def set_warning_filter(log_level):
@@ -168,3 +178,21 @@ class LogConfigurator(object):
self.file_logger.setFormatter(_FileFormatter(config=cloud_config))
self.file_logger.setLevel(log_level)
self.root_logger.addHandler(self.file_logger)
+
+ logconfig = cloud_config.config.get('logging', None)
+ if logconfig:
+ highest_level = logging.NOTSET
+ for k in logconfig.keys():
+ level = log_level_from_string(logconfig[k])
+ logging.getLogger(k).setLevel(level)
+ if (highest_level < level):
+ highest_level = level
+ self.console_logger.setLevel(highest_level)
+ if self.file_logger:
+ self.file_logger.setLevel(highest_level)
+ # loggers that are not set will use the handler level, so we
+ # need to set the global level for all the loggers
+ for logkey in logging.Logger.manager.loggerDict.keys():
+ logger = logging.getLogger(logkey)
+ if logger.level == logging.NOTSET:
+ logger.setLevel(log_level)
diff --git a/openstackclient/compute/v2/floatingip.py b/openstackclient/compute/v2/floatingip.py
index 29ecbc90..6212989f 100644
--- a/openstackclient/compute/v2/floatingip.py
+++ b/openstackclient/compute/v2/floatingip.py
@@ -68,46 +68,6 @@ class CreateFloatingIP(command.ShowOne):
return zip(*sorted(six.iteritems(info)))
-class DeleteFloatingIP(command.Command):
- """Delete a floating IP address"""
-
- def get_parser(self, prog_name):
- parser = super(DeleteFloatingIP, self).get_parser(prog_name)
- parser.add_argument(
- "ip_address",
- metavar="<ip-address>",
- help="IP address to delete (ID only)",
- )
- return parser
-
- def take_action(self, parsed_args):
- compute_client = self.app.client_manager.compute
-
- floating_ip = utils.find_resource(
- compute_client.floating_ips,
- parsed_args.ip_address,
- )
-
- compute_client.floating_ips.delete(floating_ip)
-
-
-class ListFloatingIP(command.Lister):
- """List floating IP addresses"""
-
- def take_action(self, parsed_args):
- compute_client = self.app.client_manager.compute
-
- columns = ('ID', 'Pool', 'IP', 'Fixed IP', 'Instance ID')
-
- data = compute_client.floating_ips.list()
-
- return (columns,
- (utils.get_item_properties(
- s, columns,
- formatters={},
- ) for s in data))
-
-
class RemoveFloatingIP(command.Command):
"""Remove floating IP address from server"""
diff --git a/openstackclient/identity/v3/role_assignment.py b/openstackclient/identity/v3/role_assignment.py
index d766be68..e2b0fe1f 100644
--- a/openstackclient/identity/v3/role_assignment.py
+++ b/openstackclient/identity/v3/role_assignment.py
@@ -34,6 +34,11 @@ class ListRoleAssignment(command.Lister):
metavar='<role>',
help='Role to filter (name or ID)',
)
+ parser.add_argument(
+ '--names',
+ action="store_true",
+ help='Display names instead of IDs',
+ )
user_or_group = parser.add_mutually_exclusive_group()
user_or_group.add_argument(
'--user',
@@ -107,6 +112,7 @@ class ListRoleAssignment(command.Lister):
parsed_args.group_domain,
)
+ include_names = True if parsed_args.names else False
effective = True if parsed_args.effective else False
columns = ('Role', 'User', 'Group', 'Project', 'Domain', 'Inherited')
@@ -118,17 +124,26 @@ class ListRoleAssignment(command.Lister):
project=project,
role=role,
effective=effective,
- os_inherit_extension_inherited_to=inherited_to)
+ os_inherit_extension_inherited_to=inherited_to,
+ include_names=include_names)
data_parsed = []
for assignment in data:
# Removing the extra "scope" layer in the assignment json
scope = assignment.scope
if 'project' in scope:
- setattr(assignment, 'project', scope['project']['id'])
+ if include_names:
+ prj = '@'.join([scope['project']['name'],
+ scope['project']['domain']['name']])
+ setattr(assignment, 'project', prj)
+ else:
+ setattr(assignment, 'project', scope['project']['id'])
assignment.domain = ''
elif 'domain' in scope:
- setattr(assignment, 'domain', scope['domain']['id'])
+ if include_names:
+ setattr(assignment, 'domain', scope['domain']['name'])
+ else:
+ setattr(assignment, 'domain', scope['domain']['id'])
assignment.project = ''
else:
@@ -141,17 +156,30 @@ class ListRoleAssignment(command.Lister):
del assignment.scope
if hasattr(assignment, 'user'):
- setattr(assignment, 'user', assignment.user['id'])
+ if include_names:
+ usr = '@'.join([assignment.user['name'],
+ assignment.user['domain']['name']])
+ setattr(assignment, 'user', usr)
+ else:
+ setattr(assignment, 'user', assignment.user['id'])
assignment.group = ''
elif hasattr(assignment, 'group'):
- setattr(assignment, 'group', assignment.group['id'])
+ if include_names:
+ grp = '@'.join([assignment.group['name'],
+ assignment.group['domain']['name']])
+ setattr(assignment, 'group', grp)
+ else:
+ setattr(assignment, 'group', assignment.group['id'])
assignment.user = ''
else:
assignment.user = ''
assignment.group = ''
if hasattr(assignment, 'role'):
- setattr(assignment, 'role', assignment.role['id'])
+ if include_names:
+ setattr(assignment, 'role', assignment.role['name'])
+ else:
+ setattr(assignment, 'role', assignment.role['id'])
else:
assignment.role = ''
diff --git a/openstackclient/identity/v3/token.py b/openstackclient/identity/v3/token.py
index 588c5218..9ebd1799 100644
--- a/openstackclient/identity/v3/token.py
+++ b/openstackclient/identity/v3/token.py
@@ -173,3 +173,22 @@ class IssueToken(command.ShowOne):
if 'tenant_id' in token:
token['project_id'] = token.pop('tenant_id')
return zip(*sorted(six.iteritems(token)))
+
+
+class RevokeToken(command.Command):
+ """Revoke existing token"""
+
+ def get_parser(self, prog_name):
+ parser = super(RevokeToken, self).get_parser(prog_name)
+ parser.add_argument(
+ 'token',
+ metavar='<token>',
+ help='Token to be deleted',
+ )
+ return parser
+
+ def take_action(self, parsed_args):
+ identity_client = self.app.client_manager.identity
+
+ identity_client.tokens.revoke_token(parsed_args.token)
+ return
diff --git a/openstackclient/network/common.py b/openstackclient/network/common.py
index ae489523..1e2c4cce 100644
--- a/openstackclient/network/common.py
+++ b/openstackclient/network/common.py
@@ -66,3 +66,105 @@ class NetworkAndComputeCommand(command.Command):
def take_action_compute(self, client, parsed_args):
"""Override to do something useful."""
pass
+
+
+@six.add_metaclass(abc.ABCMeta)
+class NetworkAndComputeLister(command.Lister):
+ """Network and Compute Lister
+
+ Lister class for commands that support implementation via
+ the network or compute endpoint. Such commands have different
+ implementations for take_action() and may even have different
+ arguments.
+ """
+
+ def take_action(self, parsed_args):
+ if self.app.client_manager.is_network_endpoint_enabled():
+ return self.take_action_network(self.app.client_manager.network,
+ parsed_args)
+ else:
+ return self.take_action_compute(self.app.client_manager.compute,
+ parsed_args)
+
+ def get_parser(self, prog_name):
+ self.log.debug('get_parser(%s)', prog_name)
+ parser = super(NetworkAndComputeLister, self).get_parser(prog_name)
+ parser = self.update_parser_common(parser)
+ self.log.debug('common parser: %s', parser)
+ if self.app.client_manager.is_network_endpoint_enabled():
+ return self.update_parser_network(parser)
+ else:
+ return self.update_parser_compute(parser)
+
+ def update_parser_common(self, parser):
+ """Default is no updates to parser."""
+ return parser
+
+ def update_parser_network(self, parser):
+ """Default is no updates to parser."""
+ return parser
+
+ def update_parser_compute(self, parser):
+ """Default is no updates to parser."""
+ return parser
+
+ @abc.abstractmethod
+ def take_action_network(self, client, parsed_args):
+ """Override to do something useful."""
+ pass
+
+ @abc.abstractmethod
+ def take_action_compute(self, client, parsed_args):
+ """Override to do something useful."""
+ pass
+
+
+@six.add_metaclass(abc.ABCMeta)
+class NetworkAndComputeShowOne(command.ShowOne):
+ """Network and Compute ShowOne
+
+ ShowOne class for commands that support implementation via
+ the network or compute endpoint. Such commands have different
+ implementations for take_action() and may even have different
+ arguments.
+ """
+
+ def take_action(self, parsed_args):
+ if self.app.client_manager.is_network_endpoint_enabled():
+ return self.take_action_network(self.app.client_manager.network,
+ parsed_args)
+ else:
+ return self.take_action_compute(self.app.client_manager.compute,
+ parsed_args)
+
+ def get_parser(self, prog_name):
+ self.log.debug('get_parser(%s)', prog_name)
+ parser = super(NetworkAndComputeShowOne, self).get_parser(prog_name)
+ parser = self.update_parser_common(parser)
+ self.log.debug('common parser: %s', parser)
+ if self.app.client_manager.is_network_endpoint_enabled():
+ return self.update_parser_network(parser)
+ else:
+ return self.update_parser_compute(parser)
+
+ def update_parser_common(self, parser):
+ """Default is no updates to parser."""
+ return parser
+
+ def update_parser_network(self, parser):
+ """Default is no updates to parser."""
+ return parser
+
+ def update_parser_compute(self, parser):
+ """Default is no updates to parser."""
+ return parser
+
+ @abc.abstractmethod
+ def take_action_network(self, client, parsed_args):
+ """Override to do something useful."""
+ pass
+
+ @abc.abstractmethod
+ def take_action_compute(self, client, parsed_args):
+ """Override to do something useful."""
+ pass
diff --git a/openstackclient/network/v2/floating_ip.py b/openstackclient/network/v2/floating_ip.py
new file mode 100644
index 00000000..48895048
--- /dev/null
+++ b/openstackclient/network/v2/floating_ip.py
@@ -0,0 +1,66 @@
+# 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.
+#
+
+"""IP Floating action implementations"""
+
+from openstackclient.common import utils
+from openstackclient.network import common
+
+
+class DeleteFloatingIP(common.NetworkAndComputeCommand):
+ """Delete floating IP"""
+
+ def update_parser_common(self, parser):
+ parser.add_argument(
+ 'floating_ip',
+ metavar="<floating-ip>",
+ help=("Floating IP to delete (IP address or ID)")
+ )
+ return parser
+
+ def take_action_network(self, client, parsed_args):
+ obj = client.find_ip(parsed_args.floating_ip)
+ client.delete_ip(obj)
+
+ def take_action_compute(self, client, parsed_args):
+ obj = utils.find_resource(
+ client.floating_ips,
+ parsed_args.floating_ip,
+ )
+ client.floating_ips.delete(obj.id)
+
+
+class ListFloatingIP(common.NetworkAndComputeLister):
+ """List floating IP(s)"""
+
+ columns = ('ID', 'IP', 'Fixed IP', 'Instance ID', 'Pool')
+ column_headers = ('ID', 'Floating IP', 'Fixed IP', 'Server ID', 'Pool')
+
+ def take_action_network(self, client, parsed_args):
+ query = {}
+ data = client.ips(**query)
+
+ return (self.column_headers,
+ (utils.get_item_properties(
+ s, self.columns,
+ formatters={},
+ ) for s in data))
+
+ def take_action_compute(self, client, parsed_args):
+ data = client.floating_ips.list()
+
+ return (self.column_headers,
+ (utils.get_item_properties(
+ s, self.columns,
+ formatters={},
+ ) for s in data))
diff --git a/openstackclient/network/v2/network.py b/openstackclient/network/v2/network.py
index 61237219..636c333e 100644
--- a/openstackclient/network/v2/network.py
+++ b/openstackclient/network/v2/network.py
@@ -17,6 +17,7 @@ from openstackclient.common import command
from openstackclient.common import exceptions
from openstackclient.common import utils
from openstackclient.identity import common as identity_common
+from openstackclient.network import common
def _format_admin_state(item):
@@ -141,11 +142,10 @@ class CreateNetwork(command.ShowOne):
return (columns, data)
-class DeleteNetwork(command.Command):
+class DeleteNetwork(common.NetworkAndComputeCommand):
"""Delete network(s)"""
- def get_parser(self, prog_name):
- parser = super(DeleteNetwork, self).get_parser(prog_name)
+ def update_parser_common(self, parser):
parser.add_argument(
'network',
metavar="<network>",
@@ -154,12 +154,19 @@ class DeleteNetwork(command.Command):
)
return parser
- def take_action(self, parsed_args):
- client = self.app.client_manager.network
+ def take_action_network(self, client, parsed_args):
for network in parsed_args.network:
obj = client.find_network(network)
client.delete_network(obj)
+ def take_action_compute(self, client, parsed_args):
+ for network in parsed_args.network:
+ network = utils.find_resource(
+ client.networks,
+ network,
+ )
+ client.networks.delete(network.id)
+
class ListNetwork(command.Lister):
"""List networks"""
@@ -238,7 +245,7 @@ class SetNetwork(command.Command):
def get_parser(self, prog_name):
parser = super(SetNetwork, self).get_parser(prog_name)
parser.add_argument(
- 'identifier',
+ 'network',
metavar="<network>",
help=("Network to modify (name or ID)")
)
@@ -279,7 +286,7 @@ class SetNetwork(command.Command):
def take_action(self, parsed_args):
client = self.app.client_manager.network
- obj = client.find_network(parsed_args.identifier, ignore_missing=False)
+ obj = client.find_network(parsed_args.network, ignore_missing=False)
attrs = _get_attrs(self.app.client_manager, parsed_args)
if attrs == {}:
@@ -296,7 +303,7 @@ class ShowNetwork(command.ShowOne):
def get_parser(self, prog_name):
parser = super(ShowNetwork, self).get_parser(prog_name)
parser.add_argument(
- 'identifier',
+ 'network',
metavar="<network>",
help=("Network to display (name or ID)")
)
@@ -304,7 +311,7 @@ class ShowNetwork(command.ShowOne):
def take_action(self, parsed_args):
client = self.app.client_manager.network
- obj = client.find_network(parsed_args.identifier, ignore_missing=False)
+ obj = client.find_network(parsed_args.network, ignore_missing=False)
columns = _get_columns(obj)
data = utils.get_item_properties(obj, columns, formatters=_formatters)
return (columns, data)
diff --git a/openstackclient/shell.py b/openstackclient/shell.py
index c84e2b1d..137446ef 100644
--- a/openstackclient/shell.py
+++ b/openstackclient/shell.py
@@ -234,12 +234,17 @@ class OpenStackShell(app.App):
# Do configuration file handling
# Ignore the default value of interface. Only if it is set later
# will it be used.
- cc = cloud_config.OpenStackConfig(
- override_defaults={
- 'interface': None,
- 'auth_type': auth_type,
+ try:
+ cc = cloud_config.OpenStackConfig(
+ override_defaults={
+ 'interface': None,
+ 'auth_type': auth_type,
},
)
+ except (IOError, OSError) as e:
+ self.log.critical("Could not read clouds.yaml configuration file")
+ self.print_help_if_requested()
+ raise e
# TODO(thowe): Change cliff so the default value for debug
# can be set to None.
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 d2070c2f..a1c42b45 100644
--- a/openstackclient/tests/compute/v2/fakes.py
+++ b/openstackclient/tests/compute/v2/fakes.py
@@ -90,6 +90,7 @@ 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, {})
@@ -126,6 +127,12 @@ class FakeComputev2Client(object):
self.security_group_rules = mock.Mock()
self.security_group_rules.resource_class = fakes.FakeResource(None, {})
+ self.floating_ips = mock.Mock()
+ self.floating_ips.resource_class = fakes.FakeResource(None, {})
+
+ self.networks = mock.Mock()
+ self.networks.resource_class = fakes.FakeResource(None, {})
+
self.auth_token = kwargs['token']
self.management_url = kwargs['endpoint']
@@ -501,3 +508,82 @@ class FakeAvailabilityZone(object):
availability_zones.append(availability_zone)
return availability_zones
+
+
+class FakeFloatingIP(object):
+ """Fake one or more floating ip."""
+
+ @staticmethod
+ def create_one_floating_ip(attrs={}, methods={}):
+ """Create a fake floating ip.
+
+ :param Dictionary attrs:
+ A dictionary with all attributes
+ :param Dictionary methods:
+ A dictionary with all methods
+ :return:
+ A FakeResource object, with id, ip, and so on
+ """
+ # Set default attributes.
+ floating_ip_attrs = {
+ 'id': 'floating-ip-id-' + uuid.uuid4().hex,
+ 'ip': '1.0.9.0',
+ 'fixed_ip': '2.0.9.0',
+ 'instance_id': 'server-id-' + uuid.uuid4().hex,
+ 'pool': 'public',
+ }
+
+ # Overwrite default attributes.
+ floating_ip_attrs.update(attrs)
+
+ # Set default methods.
+ floating_ip_methods = {}
+
+ # Overwrite default methods.
+ floating_ip_methods.update(methods)
+
+ floating_ip = fakes.FakeResource(
+ info=copy.deepcopy(floating_ip_attrs),
+ methods=copy.deepcopy(floating_ip_methods),
+ loaded=True)
+ return floating_ip
+
+ @staticmethod
+ def create_floating_ips(attrs={}, methods={}, count=2):
+ """Create multiple fake floating ips.
+
+ :param Dictionary attrs:
+ A dictionary with all attributes
+ :param Dictionary methods:
+ A dictionary with all methods
+ :param int count:
+ The number of floating ips to fake
+ :return:
+ A list of FakeResource objects faking the floating ips
+ """
+ floating_ips = []
+ for i in range(0, count):
+ floating_ips.append(FakeFloatingIP.create_one_floating_ip(
+ attrs,
+ methods
+ ))
+ return floating_ips
+
+ @staticmethod
+ def get_floating_ips(floating_ips=None, count=2):
+ """Get an iterable MagicMock object with a list of faked floating ips.
+
+ If floating_ips list is provided, then initialize the Mock object
+ with the list. Otherwise create one.
+
+ :param List floating ips:
+ A list of FakeResource objects faking floating ips
+ :param int count:
+ The number of floating ips to fake
+ :return:
+ An iterable Mock object with side_effect set to a list of faked
+ floating ips
+ """
+ if floating_ips is None:
+ floating_ips = FakeFloatingIP.create_floating_ips(count)
+ return mock.MagicMock(side_effect=floating_ips)
diff --git a/openstackclient/tests/compute/v2/test_flavor.py b/openstackclient/tests/compute/v2/test_flavor.py
index 9ae26962..bf78bee8 100644
--- a/openstackclient/tests/compute/v2/test_flavor.py
+++ b/openstackclient/tests/compute/v2/test_flavor.py
@@ -126,7 +126,7 @@ class TestFlavorList(TestFlavor):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # In base command class Lister in cliff, abstractmethod take_action()
+ # 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)
@@ -155,7 +155,7 @@ class TestFlavorList(TestFlavor):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # In base command class Lister in cliff, abstractmethod take_action()
+ # 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)
@@ -184,7 +184,7 @@ class TestFlavorList(TestFlavor):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # In base command class Lister in cliff, abstractmethod take_action()
+ # 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)
@@ -213,7 +213,7 @@ class TestFlavorList(TestFlavor):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # In base command class Lister in cliff, abstractmethod take_action()
+ # 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)
@@ -242,7 +242,7 @@ class TestFlavorList(TestFlavor):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # In base command class Lister in cliff, abstractmethod take_action()
+ # 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)
diff --git a/openstackclient/tests/compute/v2/test_hypervisor.py b/openstackclient/tests/compute/v2/test_hypervisor.py
index a11f59d2..8d717ba7 100644
--- a/openstackclient/tests/compute/v2/test_hypervisor.py
+++ b/openstackclient/tests/compute/v2/test_hypervisor.py
@@ -67,7 +67,7 @@ class TestHypervisorList(TestHypervisor):
verifylist = []
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # In base command class Lister in cliff, abstractmethod take_action()
+ # 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)
@@ -94,7 +94,7 @@ class TestHypervisorList(TestHypervisor):
),
)
- # In base command class Lister in cliff, abstractmethod take_action()
+ # 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)
@@ -211,7 +211,7 @@ class TestHypervisorShow(TestHypervisor):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # In base command class ShowOne in cliff, abstractmethod take_action()
+ # 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)
diff --git a/openstackclient/tests/compute/v2/test_security_group.py b/openstackclient/tests/compute/v2/test_security_group.py
index 79eefe6c..c6998cb5 100644
--- a/openstackclient/tests/compute/v2/test_security_group.py
+++ b/openstackclient/tests/compute/v2/test_security_group.py
@@ -87,7 +87,7 @@ class TestSecurityGroupCreate(TestSecurityGroup):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # In base command class ShowOne in cliff, abstractmethod take_action()
+ # 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)
@@ -112,7 +112,7 @@ class TestSecurityGroupCreate(TestSecurityGroup):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # In base command class ShowOne in cliff, abstractmethod take_action()
+ # 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)
@@ -159,7 +159,7 @@ class TestSecurityGroupList(TestSecurityGroup):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # In base command class Lister in cliff, abstractmethod take_action()
+ # 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)
diff --git a/openstackclient/tests/compute/v2/test_security_group_rule.py b/openstackclient/tests/compute/v2/test_security_group_rule.py
index d211ee4e..9a8003f3 100644
--- a/openstackclient/tests/compute/v2/test_security_group_rule.py
+++ b/openstackclient/tests/compute/v2/test_security_group_rule.py
@@ -149,7 +149,7 @@ class TestSecurityGroupRuleCreate(TestSecurityGroupRule):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # In base command class ShowOne in cliff, abstractmethod take_action()
+ # 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)
@@ -195,7 +195,7 @@ class TestSecurityGroupRuleCreate(TestSecurityGroupRule):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # In base command class ShowOne in cliff, abstractmethod take_action()
+ # 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)
@@ -245,7 +245,7 @@ class TestSecurityGroupRuleCreate(TestSecurityGroupRule):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # In base command class ShowOne in cliff, abstractmethod take_action()
+ # 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)
@@ -290,7 +290,7 @@ class TestSecurityGroupRuleCreate(TestSecurityGroupRule):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # In base command class ShowOne in cliff, abstractmethod take_action()
+ # 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)
@@ -338,7 +338,7 @@ class TestSecurityGroupRuleCreate(TestSecurityGroupRule):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # In base command class ShowOne in cliff, abstractmethod take_action()
+ # 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)
@@ -411,7 +411,7 @@ class TestSecurityGroupRuleList(TestSecurityGroupRule):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # In base command class Lister in cliff, abstractmethod take_action()
+ # 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)
@@ -449,7 +449,7 @@ class TestSecurityGroupRuleList(TestSecurityGroupRule):
parsed_args = self.check_parser(self.cmd, [], [])
- # In base command class Lister in cliff, abstractmethod take_action()
+ # 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)
diff --git a/openstackclient/tests/compute/v2/test_server.py b/openstackclient/tests/compute/v2/test_server.py
index 84402ea5..95188522 100644
--- a/openstackclient/tests/compute/v2/test_server.py
+++ b/openstackclient/tests/compute/v2/test_server.py
@@ -143,11 +143,10 @@ class TestServerCreate(TestServer):
verifylist = [
('server_name', self.new_server.name),
]
- try:
- # Missing required args should bail here
- self.check_parser(self.cmd, arglist, verifylist)
- except utils.ParserException:
- pass
+
+ # Missing required args should bail here
+ self.assertRaises(utils.ParserException, self.check_parser,
+ self.cmd, arglist, verifylist)
def test_server_create_minimal(self):
arglist = [
@@ -163,7 +162,7 @@ class TestServerCreate(TestServer):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # In base command class ShowOne in cliff, abstractmethod take_action()
+ # 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)
@@ -243,7 +242,7 @@ class TestServerCreate(TestServer):
self.app.client_manager.network.find_network = find_network
self.app.client_manager.network.find_port = find_port
- # In base command class ShowOne in cliff, abstractmethod take_action()
+ # 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)
@@ -303,7 +302,7 @@ class TestServerCreate(TestServer):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # In base command class ShowOne in cliff, abstractmethod take_action()
+ # 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)
@@ -557,7 +556,7 @@ class TestServerImageCreate(TestServer):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # In base command class ShowOne in cliff, abstractmethod take_action()
+ # 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)
@@ -582,7 +581,7 @@ class TestServerImageCreate(TestServer):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # In base command class ShowOne in cliff, abstractmethod take_action()
+ # 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)
diff --git a/openstackclient/tests/compute/v2/test_service.py b/openstackclient/tests/compute/v2/test_service.py
index 71700aa8..54adaab3 100644
--- a/openstackclient/tests/compute/v2/test_service.py
+++ b/openstackclient/tests/compute/v2/test_service.py
@@ -81,7 +81,7 @@ class TestServiceList(TestService):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # In base command class Lister in cliff, abstractmethod take_action()
+ # 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)
diff --git a/openstackclient/tests/identity/v2_0/test_catalog.py b/openstackclient/tests/identity/v2_0/test_catalog.py
index ff1d993e..1e27bb3c 100644
--- a/openstackclient/tests/identity/v2_0/test_catalog.py
+++ b/openstackclient/tests/identity/v2_0/test_catalog.py
@@ -72,7 +72,9 @@ class TestCatalogList(TestCatalog):
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.sc_mock.service_catalog.get_data.assert_called_with()
@@ -114,7 +116,9 @@ class TestCatalogList(TestCatalog):
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.sc_mock.service_catalog.get_data.assert_called_with()
@@ -146,7 +150,9 @@ class TestCatalogShow(TestCatalog):
]
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.sc_mock.service_catalog.get_data.assert_called_with()
diff --git a/openstackclient/tests/identity/v2_0/test_endpoint.py b/openstackclient/tests/identity/v2_0/test_endpoint.py
index 354b1e40..088fdcd1 100644
--- a/openstackclient/tests/identity/v2_0/test_endpoint.py
+++ b/openstackclient/tests/identity/v2_0/test_endpoint.py
@@ -69,7 +69,9 @@ class TestEndpointCreate(TestEndpoint):
]
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)
# EndpointManager.create(region, service_id, publicurl, adminurl,
@@ -130,7 +132,6 @@ class TestEndpointDelete(TestEndpoint):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
self.endpoints_mock.delete.assert_called_with(
@@ -165,7 +166,9 @@ class TestEndpointList(TestEndpoint):
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.endpoints_mock.list.assert_called_with()
@@ -189,7 +192,9 @@ class TestEndpointList(TestEndpoint):
]
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.endpoints_mock.list.assert_called_with()
@@ -240,7 +245,9 @@ class TestEndpointShow(TestEndpoint):
]
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)
# EndpointManager.list()
diff --git a/openstackclient/tests/identity/v2_0/test_project.py b/openstackclient/tests/identity/v2_0/test_project.py
index 69b29268..669c3eab 100644
--- a/openstackclient/tests/identity/v2_0/test_project.py
+++ b/openstackclient/tests/identity/v2_0/test_project.py
@@ -70,7 +70,9 @@ class TestProjectCreate(TestProject):
]
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
@@ -96,7 +98,9 @@ class TestProjectCreate(TestProject):
]
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
@@ -124,7 +128,9 @@ class TestProjectCreate(TestProject):
]
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
@@ -152,7 +158,9 @@ class TestProjectCreate(TestProject):
]
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
@@ -180,7 +188,9 @@ class TestProjectCreate(TestProject):
]
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
@@ -221,7 +231,9 @@ class TestProjectCreate(TestProject):
]
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)
# ProjectManager.create(name, description, enabled)
@@ -251,7 +263,9 @@ class TestProjectCreate(TestProject):
]
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
@@ -322,7 +336,9 @@ class TestProjectList(TestProject):
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.projects_mock.list.assert_called_with()
@@ -343,7 +359,9 @@ class TestProjectList(TestProject):
]
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.projects_mock.list.assert_called_with()
@@ -549,7 +567,9 @@ class TestProjectShow(TestProject):
]
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.projects_mock.get.assert_called_with(
identity_fakes.project_id,
diff --git a/openstackclient/tests/identity/v2_0/test_role.py b/openstackclient/tests/identity/v2_0/test_role.py
index c2bacc52..03b7f924 100644
--- a/openstackclient/tests/identity/v2_0/test_role.py
+++ b/openstackclient/tests/identity/v2_0/test_role.py
@@ -86,7 +86,9 @@ class TestRoleAdd(TestRole):
]
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)
# RoleManager.add_user_role(user, role, tenant=None)
@@ -137,7 +139,9 @@ class TestRoleCreate(TestRole):
]
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)
# RoleManager.create(name)
@@ -171,7 +175,9 @@ class TestRoleCreate(TestRole):
]
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)
# RoleManager.get(name, description, enabled)
@@ -196,7 +202,9 @@ class TestRoleCreate(TestRole):
]
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)
# RoleManager.create(name)
@@ -232,7 +240,6 @@ class TestRoleDelete(TestRole):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
self.roles_mock.delete.assert_called_with(
@@ -261,7 +268,9 @@ class TestRoleList(TestRole):
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.roles_mock.list.assert_called_with()
@@ -331,7 +340,9 @@ class TestUserRoleList(TestRole):
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.roles_mock.roles_for_user.assert_called_with(
@@ -388,7 +399,9 @@ class TestUserRoleList(TestRole):
]
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.roles_mock.roles_for_user.assert_called_with(
@@ -446,7 +459,6 @@ class TestRoleRemove(TestRole):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
# RoleManager.remove_user_role(user, role, tenant=None)
@@ -480,7 +492,9 @@ class TestRoleShow(TestRole):
]
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)
# RoleManager.get(role)
diff --git a/openstackclient/tests/identity/v2_0/test_service.py b/openstackclient/tests/identity/v2_0/test_service.py
index b97786b4..606b1433 100644
--- a/openstackclient/tests/identity/v2_0/test_service.py
+++ b/openstackclient/tests/identity/v2_0/test_service.py
@@ -69,7 +69,9 @@ class TestServiceCreate(TestService):
]
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)
# ServiceManager.create(name, service_type, description)
@@ -95,7 +97,9 @@ class TestServiceCreate(TestService):
]
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)
# ServiceManager.create(name, service_type, description)
@@ -121,7 +125,9 @@ class TestServiceCreate(TestService):
]
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)
# ServiceManager.create(name, service_type, description)
@@ -148,7 +154,9 @@ class TestServiceCreate(TestService):
]
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)
# ServiceManager.create(name, service_type, description)
@@ -186,7 +194,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.services_mock.delete.assert_called_with(
@@ -215,7 +222,9 @@ class TestServiceList(TestService):
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.services_mock.list.assert_called_with()
@@ -238,7 +247,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.
columns, data = self.cmd.take_action(parsed_args)
self.services_mock.list.assert_called_with()
@@ -277,7 +288,9 @@ class TestServiceShow(TestService):
]
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)
# ServiceManager.get(id)
diff --git a/openstackclient/tests/identity/v2_0/test_token.py b/openstackclient/tests/identity/v2_0/test_token.py
index ce2faef3..7687a063 100644
--- a/openstackclient/tests/identity/v2_0/test_token.py
+++ b/openstackclient/tests/identity/v2_0/test_token.py
@@ -43,7 +43,9 @@ class TestTokenIssue(TestToken):
verifylist = []
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.sc_mock.get_token.assert_called_with()
diff --git a/openstackclient/tests/identity/v2_0/test_user.py b/openstackclient/tests/identity/v2_0/test_user.py
index a25def87..a7332e63 100644
--- a/openstackclient/tests/identity/v2_0/test_user.py
+++ b/openstackclient/tests/identity/v2_0/test_user.py
@@ -83,7 +83,9 @@ class TestUserCreate(TestUser):
]
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
@@ -114,7 +116,9 @@ class TestUserCreate(TestUser):
]
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
@@ -143,7 +147,9 @@ class TestUserCreate(TestUser):
]
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.
mocker = mock.Mock()
mocker.return_value = 'abc123'
with mock.patch("openstackclient.common.utils.get_password", mocker):
@@ -176,7 +182,9 @@ class TestUserCreate(TestUser):
]
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
@@ -221,7 +229,9 @@ class TestUserCreate(TestUser):
]
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
@@ -259,7 +269,9 @@ class TestUserCreate(TestUser):
]
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
@@ -290,7 +302,9 @@ class TestUserCreate(TestUser):
]
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
@@ -332,7 +346,9 @@ class TestUserCreate(TestUser):
]
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)
# UserManager.create(name, password, email, tenant_id=, enabled=)
@@ -352,7 +368,9 @@ class TestUserCreate(TestUser):
]
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
@@ -396,7 +414,6 @@ class TestUserDelete(TestUser):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
self.users_mock.delete.assert_called_with(
@@ -449,7 +466,9 @@ class TestUserList(TestUser):
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.users_mock.list.assert_called_with(tenant_id=None)
@@ -467,7 +486,9 @@ class TestUserList(TestUser):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
project_id = identity_fakes.PROJECT_2['id']
- # 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.users_mock.list.assert_called_with(tenant_id=project_id)
@@ -484,7 +505,9 @@ class TestUserList(TestUser):
]
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.users_mock.list.assert_called_with(tenant_id=None)
@@ -554,7 +577,6 @@ class TestUserSet(TestUser):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
# Set expected values
@@ -585,7 +607,6 @@ class TestUserSet(TestUser):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
# UserManager.update_password(user, password)
@@ -611,7 +632,6 @@ class TestUserSet(TestUser):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
mocker = mock.Mock()
mocker.return_value = 'abc123'
with mock.patch("openstackclient.common.utils.get_password", mocker):
@@ -639,7 +659,6 @@ class TestUserSet(TestUser):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
# Set expected values
@@ -669,7 +688,6 @@ class TestUserSet(TestUser):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
# UserManager.update_tenant(user, tenant)
@@ -694,7 +712,6 @@ class TestUserSet(TestUser):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
# Set expected values
@@ -723,7 +740,6 @@ class TestUserSet(TestUser):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
# Set expected values
@@ -760,7 +776,9 @@ class TestUserShow(TestUser):
]
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.users_mock.get.assert_called_with(identity_fakes.user_id)
diff --git a/openstackclient/tests/identity/v3/fakes.py b/openstackclient/tests/identity/v3/fakes.py
index 9fe341ed..a06802c5 100644
--- a/openstackclient/tests/identity/v3/fakes.py
+++ b/openstackclient/tests/identity/v3/fakes.py
@@ -314,6 +314,22 @@ ASSIGNMENT_WITH_PROJECT_ID_AND_USER_ID = {
'role': {'id': role_id},
}
+ASSIGNMENT_WITH_PROJECT_ID_AND_USER_ID_INCLUDE_NAMES = {
+ 'scope': {
+ 'project': {
+ 'domain': {'id': domain_id,
+ 'name': domain_name},
+ 'id': project_id,
+ 'name': project_name}},
+ 'user': {
+ 'domain': {'id': domain_id,
+ 'name': domain_name},
+ 'id': user_id,
+ 'name': user_name},
+ 'role': {'id': role_id,
+ 'name': role_name},
+}
+
ASSIGNMENT_WITH_PROJECT_ID_AND_USER_ID_INHERITED = {
'scope': {'project': {'id': project_id},
'OS-INHERIT:inherited_to': 'projects'},
@@ -333,6 +349,19 @@ ASSIGNMENT_WITH_DOMAIN_ID_AND_USER_ID = {
'role': {'id': role_id},
}
+ASSIGNMENT_WITH_DOMAIN_ID_AND_USER_ID_INCLUDE_NAMES = {
+ 'scope': {
+ 'domain': {'id': domain_id,
+ 'name': domain_name}},
+ 'user': {
+ 'domain': {'id': domain_id,
+ 'name': domain_name},
+ 'id': user_id,
+ 'name': user_name},
+ 'role': {'id': role_id,
+ 'name': role_name},
+}
+
ASSIGNMENT_WITH_DOMAIN_ID_AND_USER_ID_INHERITED = {
'scope': {'domain': {'id': domain_id},
'OS-INHERIT:inherited_to': 'projects'},
@@ -420,6 +449,8 @@ class FakeIdentityv3Client(object):
self.session = mock.Mock()
self.session.auth.auth_ref.service_catalog.resource_class = \
fakes.FakeResource(None, {})
+ self.tokens = mock.Mock()
+ self.tokens.resource_class = fakes.FakeResource(None, {})
self.trusts = mock.Mock()
self.trusts.resource_class = fakes.FakeResource(None, {})
self.users = mock.Mock()
diff --git a/openstackclient/tests/identity/v3/test_catalog.py b/openstackclient/tests/identity/v3/test_catalog.py
index 6bb962de..a03c9d3e 100644
--- a/openstackclient/tests/identity/v3/test_catalog.py
+++ b/openstackclient/tests/identity/v3/test_catalog.py
@@ -68,7 +68,9 @@ class TestCatalogList(TestCatalog):
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.sc_mock.service_catalog.get_data.assert_called_with()
@@ -101,7 +103,9 @@ class TestCatalogShow(TestCatalog):
]
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.sc_mock.service_catalog.get_data.assert_called_with()
diff --git a/openstackclient/tests/identity/v3/test_consumer.py b/openstackclient/tests/identity/v3/test_consumer.py
index 4e807562..7f6af734 100644
--- a/openstackclient/tests/identity/v3/test_consumer.py
+++ b/openstackclient/tests/identity/v3/test_consumer.py
@@ -121,7 +121,9 @@ class TestConsumerList(TestOAuth1):
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.consumers_mock.list.assert_called_with()
diff --git a/openstackclient/tests/identity/v3/test_domain.py b/openstackclient/tests/identity/v3/test_domain.py
index 969c2df7..9de6b26a 100644
--- a/openstackclient/tests/identity/v3/test_domain.py
+++ b/openstackclient/tests/identity/v3/test_domain.py
@@ -63,7 +63,9 @@ class TestDomainCreate(TestDomain):
]
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
@@ -90,7 +92,9 @@ class TestDomainCreate(TestDomain):
]
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
@@ -117,7 +121,9 @@ class TestDomainCreate(TestDomain):
]
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
@@ -144,7 +150,9 @@ class TestDomainCreate(TestDomain):
]
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
@@ -215,7 +223,9 @@ class TestDomainList(TestDomain):
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.domains_mock.list.assert_called_with()
@@ -380,7 +390,9 @@ class TestDomainShow(TestDomain):
]
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.domains_mock.get.assert_called_with(
identity_fakes.domain_id,
diff --git a/openstackclient/tests/identity/v3/test_endpoint.py b/openstackclient/tests/identity/v3/test_endpoint.py
index fb88e004..1c481930 100644
--- a/openstackclient/tests/identity/v3/test_endpoint.py
+++ b/openstackclient/tests/identity/v3/test_endpoint.py
@@ -81,7 +81,9 @@ class TestEndpointCreate(TestEndpoint):
]
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
@@ -126,7 +128,9 @@ class TestEndpointCreate(TestEndpoint):
]
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
@@ -170,7 +174,9 @@ class TestEndpointCreate(TestEndpoint):
]
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
@@ -214,7 +220,9 @@ class TestEndpointCreate(TestEndpoint):
]
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
@@ -315,7 +323,9 @@ class TestEndpointList(TestEndpoint):
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.endpoints_mock.list.assert_called_with()
@@ -342,7 +352,9 @@ class TestEndpointList(TestEndpoint):
]
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
@@ -374,7 +386,9 @@ class TestEndpointList(TestEndpoint):
]
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
@@ -406,7 +420,9 @@ class TestEndpointList(TestEndpoint):
]
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
@@ -665,7 +681,9 @@ class TestEndpointShow(TestEndpoint):
]
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.endpoints_mock.get.assert_called_with(
identity_fakes.endpoint_id,
diff --git a/openstackclient/tests/identity/v3/test_group.py b/openstackclient/tests/identity/v3/test_group.py
index 59a36819..c5f5dbca 100644
--- a/openstackclient/tests/identity/v3/test_group.py
+++ b/openstackclient/tests/identity/v3/test_group.py
@@ -85,7 +85,9 @@ class TestGroupList(TestGroup):
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
@@ -110,7 +112,9 @@ class TestGroupList(TestGroup):
]
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
@@ -135,7 +139,9 @@ class TestGroupList(TestGroup):
]
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
@@ -160,7 +166,9 @@ class TestGroupList(TestGroup):
]
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/identity/v3/test_identity_provider.py b/openstackclient/tests/identity/v3/test_identity_provider.py
index 50a922b8..75911510 100644
--- a/openstackclient/tests/identity/v3/test_identity_provider.py
+++ b/openstackclient/tests/identity/v3/test_identity_provider.py
@@ -290,7 +290,9 @@ class TestIdentityProviderList(TestIdentityProvider):
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.identity_providers_mock.list.assert_called_with()
diff --git a/openstackclient/tests/identity/v3/test_project.py b/openstackclient/tests/identity/v3/test_project.py
index 36540201..b834e943 100644
--- a/openstackclient/tests/identity/v3/test_project.py
+++ b/openstackclient/tests/identity/v3/test_project.py
@@ -83,7 +83,9 @@ class TestProjectCreate(TestProject):
]
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
@@ -125,7 +127,9 @@ class TestProjectCreate(TestProject):
]
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
@@ -159,7 +163,9 @@ class TestProjectCreate(TestProject):
]
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
@@ -225,7 +231,9 @@ class TestProjectCreate(TestProject):
]
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
@@ -258,7 +266,9 @@ class TestProjectCreate(TestProject):
]
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
@@ -290,7 +300,9 @@ class TestProjectCreate(TestProject):
]
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
@@ -464,7 +476,9 @@ class TestProjectList(TestProject):
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.projects_mock.list.assert_called_with()
@@ -480,7 +494,9 @@ class TestProjectList(TestProject):
]
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.projects_mock.list.assert_called_with()
@@ -511,7 +527,9 @@ class TestProjectList(TestProject):
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.projects_mock.list.assert_called_with(
domain=identity_fakes.domain_id)
@@ -737,7 +755,9 @@ class TestProjectShow(TestProject):
]
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.projects_mock.get.assert_called_with(
identity_fakes.project_id,
diff --git a/openstackclient/tests/identity/v3/test_region.py b/openstackclient/tests/identity/v3/test_region.py
index 9ac9ddf8..f5f50793 100644
--- a/openstackclient/tests/identity/v3/test_region.py
+++ b/openstackclient/tests/identity/v3/test_region.py
@@ -64,7 +64,9 @@ class TestRegionCreate(TestRegion):
]
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
@@ -89,7 +91,9 @@ class TestRegionCreate(TestRegion):
]
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
@@ -116,7 +120,9 @@ class TestRegionCreate(TestRegion):
]
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
@@ -193,7 +199,9 @@ class TestRegionList(TestRegion):
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.regions_mock.list.assert_called_with()
@@ -209,7 +217,9 @@ class TestRegionList(TestRegion):
]
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.regions_mock.list.assert_called_with(
parent_region_id=identity_fakes.region_parent_region_id)
@@ -316,7 +326,9 @@ class TestRegionShow(TestRegion):
]
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.regions_mock.get.assert_called_with(
identity_fakes.region_id,
diff --git a/openstackclient/tests/identity/v3/test_role.py b/openstackclient/tests/identity/v3/test_role.py
index 1910c874..f3661324 100644
--- a/openstackclient/tests/identity/v3/test_role.py
+++ b/openstackclient/tests/identity/v3/test_role.py
@@ -258,7 +258,9 @@ class TestRoleCreate(TestRole):
]
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
@@ -304,7 +306,6 @@ class TestRoleDelete(TestRole):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
self.roles_mock.delete.assert_called_with(
@@ -365,7 +366,9 @@ class TestRoleList(TestRole):
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.roles_mock.list.assert_called_with()
@@ -384,7 +387,9 @@ class TestRoleList(TestRole):
]
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
@@ -410,7 +415,9 @@ class TestRoleList(TestRole):
]
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
@@ -438,7 +445,9 @@ class TestRoleList(TestRole):
]
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
@@ -473,7 +482,9 @@ class TestRoleList(TestRole):
]
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
@@ -508,7 +519,9 @@ class TestRoleList(TestRole):
]
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
@@ -543,7 +556,9 @@ class TestRoleList(TestRole):
]
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
@@ -625,7 +640,6 @@ class TestRoleRemove(TestRole):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
# Set expected values
@@ -658,7 +672,6 @@ class TestRoleRemove(TestRole):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
# Set expected values
@@ -692,7 +705,6 @@ class TestRoleRemove(TestRole):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
# Set expected values
@@ -725,7 +737,6 @@ class TestRoleRemove(TestRole):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
# Set expected values
@@ -767,7 +778,6 @@ class TestRoleSet(TestRole):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
# Set expected values
@@ -804,7 +814,9 @@ class TestRoleShow(TestRole):
]
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)
# RoleManager.get(role)
diff --git a/openstackclient/tests/identity/v3/test_role_assignment.py b/openstackclient/tests/identity/v3/test_role_assignment.py
index 5723a334..5def7632 100644
--- a/openstackclient/tests/identity/v3/test_role_assignment.py
+++ b/openstackclient/tests/identity/v3/test_role_assignment.py
@@ -86,7 +86,9 @@ class TestRoleAssignmentList(TestRoleAssignment):
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.role_assignments_mock.list.assert_called_with(
@@ -96,7 +98,8 @@ class TestRoleAssignmentList(TestRoleAssignment):
role=None,
user=None,
project=None,
- os_inherit_extension_inherited_to=None)
+ os_inherit_extension_inherited_to=None,
+ include_names=False)
self.assertEqual(self.columns, columns)
datalist = ((
@@ -143,10 +146,13 @@ class TestRoleAssignmentList(TestRoleAssignment):
('role', None),
('effective', False),
('inherited', False),
+ ('names', False),
]
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.role_assignments_mock.list.assert_called_with(
@@ -156,7 +162,8 @@ class TestRoleAssignmentList(TestRoleAssignment):
project=None,
role=None,
effective=False,
- os_inherit_extension_inherited_to=None)
+ os_inherit_extension_inherited_to=None,
+ include_names=False)
self.assertEqual(self.columns, columns)
datalist = ((
@@ -203,10 +210,13 @@ class TestRoleAssignmentList(TestRoleAssignment):
('role', None),
('effective', False),
('inherited', False),
+ ('names', False),
]
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.role_assignments_mock.list.assert_called_with(
@@ -216,7 +226,8 @@ class TestRoleAssignmentList(TestRoleAssignment):
project=None,
role=None,
user=None,
- os_inherit_extension_inherited_to=None)
+ os_inherit_extension_inherited_to=None,
+ include_names=False)
self.assertEqual(self.columns, columns)
datalist = ((
@@ -263,10 +274,13 @@ class TestRoleAssignmentList(TestRoleAssignment):
('role', None),
('effective', False),
('inherited', False),
+ ('names', False),
]
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.role_assignments_mock.list.assert_called_with(
@@ -276,7 +290,8 @@ class TestRoleAssignmentList(TestRoleAssignment):
project=None,
role=None,
user=None,
- os_inherit_extension_inherited_to=None)
+ os_inherit_extension_inherited_to=None,
+ include_names=False)
self.assertEqual(self.columns, columns)
datalist = ((
@@ -323,10 +338,13 @@ class TestRoleAssignmentList(TestRoleAssignment):
('role', None),
('effective', False),
('inherited', False),
+ ('names', False),
]
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.role_assignments_mock.list.assert_called_with(
@@ -336,7 +354,8 @@ class TestRoleAssignmentList(TestRoleAssignment):
project=self.projects_mock.get(),
role=None,
user=None,
- os_inherit_extension_inherited_to=None)
+ os_inherit_extension_inherited_to=None,
+ include_names=False)
self.assertEqual(self.columns, columns)
datalist = ((
@@ -381,10 +400,13 @@ class TestRoleAssignmentList(TestRoleAssignment):
('role', None),
('effective', True),
('inherited', False),
+ ('names', False),
]
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.role_assignments_mock.list.assert_called_with(
@@ -394,7 +416,8 @@ class TestRoleAssignmentList(TestRoleAssignment):
project=None,
role=None,
user=None,
- os_inherit_extension_inherited_to=None)
+ os_inherit_extension_inherited_to=None,
+ include_names=False)
self.assertEqual(self.columns, columns)
datalist = ((
@@ -441,10 +464,13 @@ class TestRoleAssignmentList(TestRoleAssignment):
('role', None),
('effective', False),
('inherited', True),
+ ('names', False),
]
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.role_assignments_mock.list.assert_called_with(
@@ -454,7 +480,8 @@ class TestRoleAssignmentList(TestRoleAssignment):
project=None,
role=None,
user=None,
- os_inherit_extension_inherited_to='projects')
+ os_inherit_extension_inherited_to='projects',
+ include_names=False)
self.assertEqual(self.columns, columns)
datalist = ((
@@ -472,3 +499,72 @@ class TestRoleAssignmentList(TestRoleAssignment):
True
),)
self.assertEqual(datalist, tuple(data))
+
+ def test_role_assignment_list_include_names(self):
+
+ self.role_assignments_mock.list.return_value = [
+ fakes.FakeResource(
+ None,
+ copy.deepcopy(
+ identity_fakes
+ .ASSIGNMENT_WITH_PROJECT_ID_AND_USER_ID_INCLUDE_NAMES),
+ loaded=True,
+ ),
+ fakes.FakeResource(
+ None,
+ copy.deepcopy(
+ identity_fakes
+ .ASSIGNMENT_WITH_DOMAIN_ID_AND_USER_ID_INCLUDE_NAMES),
+ loaded=True,
+ ),
+ ]
+
+ arglist = ['--names']
+ verifylist = [
+ ('user', None),
+ ('group', None),
+ ('domain', None),
+ ('project', None),
+ ('role', None),
+ ('effective', False),
+ ('inherited', False),
+ ('names', True),
+ ]
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+
+ # DisplayCommandBase.take_action() returns two tuples
+
+ # This test will not run correctly until the patch in the python
+ # client is merged. Once that is done 'data' should return the
+ # correct information
+ columns, data = self.cmd.take_action(parsed_args)
+
+ self.role_assignments_mock.list.assert_called_with(
+ domain=None,
+ group=None,
+ effective=False,
+ project=None,
+ role=None,
+ user=None,
+ os_inherit_extension_inherited_to=None,
+ include_names=True)
+
+ collist = ('Role', 'User', 'Group', 'Project', 'Domain', 'Inherited')
+ self.assertEqual(columns, collist)
+
+ datalist1 = ((
+ identity_fakes.role_name,
+ '@'.join([identity_fakes.user_name, identity_fakes.domain_name]),
+ '',
+ '@'.join([identity_fakes.project_name,
+ identity_fakes.domain_name]),
+ '',
+ False
+ ), (identity_fakes.role_name,
+ '@'.join([identity_fakes.user_name, identity_fakes.domain_name]),
+ '',
+ '',
+ identity_fakes.domain_name,
+ False
+ ),)
+ self.assertEqual(tuple(data), datalist1)
diff --git a/openstackclient/tests/identity/v3/test_service.py b/openstackclient/tests/identity/v3/test_service.py
index c609142c..2bc5927f 100644
--- a/openstackclient/tests/identity/v3/test_service.py
+++ b/openstackclient/tests/identity/v3/test_service.py
@@ -73,7 +73,9 @@ class TestServiceCreate(TestService):
]
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)
# ServiceManager.create(name=, type=, enabled=, **kwargs)
@@ -101,7 +103,9 @@ class TestServiceCreate(TestService):
]
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)
# ServiceManager.create(name=, type=, enabled=, **kwargs)
@@ -129,7 +133,9 @@ class TestServiceCreate(TestService):
]
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)
# ServiceManager.create(name=, type=, enabled=, **kwargs)
@@ -157,7 +163,9 @@ class TestServiceCreate(TestService):
]
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)
# ServiceManager.create(name=, type=, enabled=, **kwargs)
@@ -225,7 +233,9 @@ class TestServiceList(TestService):
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.services_mock.list.assert_called_with()
@@ -248,7 +258,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.
columns, data = self.cmd.take_action(parsed_args)
self.services_mock.list.assert_called_with()
@@ -465,7 +477,9 @@ class TestServiceShow(TestService):
]
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)
# ServiceManager.get(id)
diff --git a/openstackclient/tests/identity/v3/test_service_provider.py b/openstackclient/tests/identity/v3/test_service_provider.py
index 24fa7c7b..fb7576f1 100644
--- a/openstackclient/tests/identity/v3/test_service_provider.py
+++ b/openstackclient/tests/identity/v3/test_service_provider.py
@@ -220,7 +220,9 @@ class TestServiceProviderList(TestServiceProvider):
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.service_providers_mock.list.assert_called_with()
diff --git a/openstackclient/tests/identity/v3/test_token.py b/openstackclient/tests/identity/v3/test_token.py
index 6ad4845d..b051aacb 100644
--- a/openstackclient/tests/identity/v3/test_token.py
+++ b/openstackclient/tests/identity/v3/test_token.py
@@ -44,7 +44,9 @@ class TestTokenIssue(TestToken):
self.sc_mock.get_token.return_value = \
identity_fakes.TOKEN_WITH_PROJECT_ID
- # 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.sc_mock.get_token.assert_called_with()
@@ -66,7 +68,9 @@ class TestTokenIssue(TestToken):
self.sc_mock.get_token.return_value = \
identity_fakes.TOKEN_WITH_DOMAIN_ID
- # 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.sc_mock.get_token.assert_called_with()
@@ -80,3 +84,24 @@ class TestTokenIssue(TestToken):
identity_fakes.user_id,
)
self.assertEqual(datalist, data)
+
+
+class TestTokenRevoke(TestToken):
+
+ TOKEN = 'fob'
+
+ def setUp(self):
+ super(TestTokenRevoke, self).setUp()
+ self.tokens_mock = self.app.client_manager.identity.tokens
+ self.tokens_mock.reset_mock()
+ self.tokens_mock.revoke_token.return_value = True
+ self.cmd = token.RevokeToken(self.app, None)
+
+ def test_token_revoke(self):
+ arglist = [self.TOKEN]
+ verifylist = [('token', self.TOKEN)]
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+
+ self.cmd.take_action(parsed_args)
+
+ self.tokens_mock.revoke_token.assert_called_with(self.TOKEN)
diff --git a/openstackclient/tests/identity/v3/test_trust.py b/openstackclient/tests/identity/v3/test_trust.py
index b90e7815..2a748872 100644
--- a/openstackclient/tests/identity/v3/test_trust.py
+++ b/openstackclient/tests/identity/v3/test_trust.py
@@ -81,7 +81,9 @@ class TestTrustCreate(TestTrust):
]
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
@@ -167,7 +169,9 @@ class TestTrustList(TestTrust):
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.trusts_mock.list.assert_called_with()
@@ -209,7 +213,9 @@ class TestTrustShow(TestTrust):
]
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.trusts_mock.get.assert_called_with(identity_fakes.trust_id)
diff --git a/openstackclient/tests/identity/v3/test_unscoped_saml.py b/openstackclient/tests/identity/v3/test_unscoped_saml.py
index 6a799094..c2f14493 100644
--- a/openstackclient/tests/identity/v3/test_unscoped_saml.py
+++ b/openstackclient/tests/identity/v3/test_unscoped_saml.py
@@ -52,7 +52,9 @@ class TestProjectList(TestUnscopedSAML):
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.projects_mock.list.assert_called_with()
@@ -101,7 +103,9 @@ class TestDomainList(TestUnscopedSAML):
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.domains_mock.list.assert_called_with()
diff --git a/openstackclient/tests/identity/v3/test_user.py b/openstackclient/tests/identity/v3/test_user.py
index 1871ed18..3757c5f8 100644
--- a/openstackclient/tests/identity/v3/test_user.py
+++ b/openstackclient/tests/identity/v3/test_user.py
@@ -104,7 +104,9 @@ class TestUserCreate(TestUser):
]
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
@@ -141,7 +143,9 @@ class TestUserCreate(TestUser):
]
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
@@ -176,7 +180,9 @@ class TestUserCreate(TestUser):
]
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.
mocker = mock.Mock()
mocker.return_value = 'abc123'
with mock.patch("openstackclient.common.utils.get_password", mocker):
@@ -214,7 +220,9 @@ class TestUserCreate(TestUser):
]
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
@@ -264,7 +272,9 @@ class TestUserCreate(TestUser):
]
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
@@ -324,7 +334,9 @@ class TestUserCreate(TestUser):
]
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
@@ -367,7 +379,9 @@ class TestUserCreate(TestUser):
]
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
@@ -401,7 +415,9 @@ class TestUserCreate(TestUser):
]
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
@@ -435,7 +451,9 @@ class TestUserCreate(TestUser):
]
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
@@ -481,7 +499,6 @@ class TestUserDelete(TestUser):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
self.users_mock.delete.assert_called_with(
@@ -553,7 +570,9 @@ class TestUserList(TestUser):
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
@@ -578,7 +597,9 @@ class TestUserList(TestUser):
]
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
@@ -603,7 +624,9 @@ class TestUserList(TestUser):
]
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
@@ -628,7 +651,9 @@ class TestUserList(TestUser):
]
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
@@ -673,7 +698,9 @@ class TestUserList(TestUser):
]
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)
kwargs = {
@@ -746,7 +773,6 @@ class TestUserSet(TestUser):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
# Set expected values
@@ -778,7 +804,6 @@ class TestUserSet(TestUser):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
# Set expected values
@@ -810,7 +835,6 @@ class TestUserSet(TestUser):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
mocker = mock.Mock()
mocker.return_value = 'abc123'
with mock.patch("openstackclient.common.utils.get_password", mocker):
@@ -844,7 +868,6 @@ class TestUserSet(TestUser):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
# Set expected values
@@ -875,7 +898,6 @@ class TestUserSet(TestUser):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
# Set expected values
@@ -908,7 +930,6 @@ class TestUserSet(TestUser):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
# Set expected values
@@ -939,7 +960,6 @@ class TestUserSet(TestUser):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
# Set expected values
@@ -969,7 +989,6 @@ class TestUserSet(TestUser):
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
# Set expected values
@@ -1072,7 +1091,9 @@ class TestUserShow(TestUser):
]
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.users_mock.get.assert_called_with(identity_fakes.user_id)
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/test_common.py b/openstackclient/tests/network/test_common.py
index a3396b9d..4700c66a 100644
--- a/openstackclient/tests/network/test_common.py
+++ b/openstackclient/tests/network/test_common.py
@@ -18,57 +18,103 @@ from openstackclient.network import common
from openstackclient.tests import utils
+def _add_common_argument(parser):
+ parser.add_argument(
+ 'common',
+ metavar='<common>',
+ help='Common argument',
+ )
+ return parser
+
+
+def _add_network_argument(parser):
+ parser.add_argument(
+ 'network',
+ metavar='<network>',
+ help='Network argument',
+ )
+ return parser
+
+
+def _add_compute_argument(parser):
+ parser.add_argument(
+ 'compute',
+ metavar='<compute>',
+ help='Compute argument',
+ )
+ return parser
+
+
class FakeNetworkAndComputeCommand(common.NetworkAndComputeCommand):
def update_parser_common(self, parser):
- parser.add_argument(
- 'common',
- metavar='<common>',
- help='Common argument',
- )
- return parser
+ return _add_common_argument(parser)
def update_parser_network(self, parser):
- parser.add_argument(
- 'network',
- metavar='<network>',
- help='Network argument',
- )
- return parser
+ return _add_network_argument(parser)
def update_parser_compute(self, parser):
- parser.add_argument(
- 'compute',
- metavar='<compute>',
- help='Compute argument',
- )
- return parser
+ return _add_compute_argument(parser)
def take_action_network(self, client, parsed_args):
- client.network_action(parsed_args)
- return 'take_action_network'
+ return client.network_action(parsed_args)
def take_action_compute(self, client, parsed_args):
- client.compute_action(parsed_args)
- return 'take_action_compute'
+ return client.compute_action(parsed_args)
+
+class FakeNetworkAndComputeLister(common.NetworkAndComputeLister):
+ def update_parser_common(self, parser):
+ return _add_common_argument(parser)
+
+ def update_parser_network(self, parser):
+ return _add_network_argument(parser)
-class TestNetworkAndComputeCommand(utils.TestCommand):
+ def update_parser_compute(self, parser):
+ return _add_compute_argument(parser)
+
+ def take_action_network(self, client, parsed_args):
+ return client.network_action(parsed_args)
+
+ def take_action_compute(self, client, parsed_args):
+ return client.compute_action(parsed_args)
+
+
+class FakeNetworkAndComputeShowOne(common.NetworkAndComputeShowOne):
+ def update_parser_common(self, parser):
+ return _add_common_argument(parser)
+
+ def update_parser_network(self, parser):
+ return _add_network_argument(parser)
+
+ def update_parser_compute(self, parser):
+ return _add_compute_argument(parser)
+
+ def take_action_network(self, client, parsed_args):
+ return client.network_action(parsed_args)
+
+ def take_action_compute(self, client, parsed_args):
+ return client.compute_action(parsed_args)
+
+
+class TestNetworkAndCompute(utils.TestCommand):
def setUp(self):
- super(TestNetworkAndComputeCommand, self).setUp()
+ super(TestNetworkAndCompute, self).setUp()
self.namespace = argparse.Namespace()
# Create network client mocks.
self.app.client_manager.network = mock.Mock()
self.network = self.app.client_manager.network
- self.network.network_action = mock.Mock(return_value=None)
+ self.network.network_action = mock.Mock(
+ return_value='take_action_network')
# Create compute client mocks.
self.app.client_manager.compute = mock.Mock()
self.compute = self.app.client_manager.compute
- self.compute.compute_action = mock.Mock(return_value=None)
+ self.compute.compute_action = mock.Mock(
+ return_value='take_action_compute')
- # Get the command object to test
+ # Subclasses can override the command object to test.
self.cmd = FakeNetworkAndComputeCommand(self.app, self.namespace)
def test_take_action_network(self):
@@ -101,3 +147,21 @@ class TestNetworkAndComputeCommand(utils.TestCommand):
result = self.cmd.take_action(parsed_args)
self.compute.compute_action.assert_called_with(parsed_args)
self.assertEqual('take_action_compute', result)
+
+
+class TestNetworkAndComputeCommand(TestNetworkAndCompute):
+ def setUp(self):
+ super(TestNetworkAndComputeCommand, self).setUp()
+ self.cmd = FakeNetworkAndComputeCommand(self.app, self.namespace)
+
+
+class TestNetworkAndComputeLister(TestNetworkAndCompute):
+ def setUp(self):
+ super(TestNetworkAndComputeLister, self).setUp()
+ self.cmd = FakeNetworkAndComputeLister(self.app, self.namespace)
+
+
+class TestNetworkAndComputeShowOne(TestNetworkAndCompute):
+ def setUp(self):
+ super(TestNetworkAndComputeShowOne, self).setUp()
+ self.cmd = FakeNetworkAndComputeShowOne(self.app, self.namespace)
diff --git a/openstackclient/tests/network/v2/fakes.py b/openstackclient/tests/network/v2/fakes.py
index d5de7910..8591a09a 100644
--- a/openstackclient/tests/network/v2/fakes.py
+++ b/openstackclient/tests/network/v2/fakes.py
@@ -226,7 +226,6 @@ class FakePort(object):
:return:
A FakeResource object, with id, name, etc.
"""
-
# Set default attributes.
port_attrs = {
'admin_state_up': True,
@@ -601,3 +600,82 @@ class FakeSubnet(object):
subnets.append(FakeSubnet.create_one_subnet(attrs, methods))
return subnets
+
+
+class FakeFloatingIP(object):
+ """Fake one or more floating ip."""
+
+ @staticmethod
+ def create_one_floating_ip(attrs={}, methods={}):
+ """Create a fake floating ip.
+
+ :param Dictionary attrs:
+ A dictionary with all attributes
+ :param Dictionary methods:
+ A dictionary with all methods
+ :return:
+ A FakeResource object, with id, ip, and so on
+ """
+ # Set default attributes.
+ floating_ip_attrs = {
+ 'id': 'floating-ip-id-' + uuid.uuid4().hex,
+ 'ip': '1.0.9.0',
+ 'fixed_ip': '2.0.9.0',
+ 'instance_id': 'server-id-' + uuid.uuid4().hex,
+ 'pool': 'public',
+ }
+
+ # Overwrite default attributes.
+ floating_ip_attrs.update(attrs)
+
+ # Set default methods.
+ floating_ip_methods = {}
+
+ # Overwrite default methods.
+ floating_ip_methods.update(methods)
+
+ floating_ip = fakes.FakeResource(
+ info=copy.deepcopy(floating_ip_attrs),
+ methods=copy.deepcopy(floating_ip_methods),
+ loaded=True)
+ return floating_ip
+
+ @staticmethod
+ def create_floating_ips(attrs={}, methods={}, count=2):
+ """Create multiple fake floating ips.
+
+ :param Dictionary attrs:
+ A dictionary with all attributes
+ :param Dictionary methods:
+ A dictionary with all methods
+ :param int count:
+ The number of floating ips to fake
+ :return:
+ A list of FakeResource objects faking the floating ips
+ """
+ floating_ips = []
+ for i in range(0, count):
+ floating_ips.append(FakeFloatingIP.create_one_floating_ip(
+ attrs,
+ methods
+ ))
+ return floating_ips
+
+ @staticmethod
+ def get_floating_ips(floating_ips=None, count=2):
+ """Get an iterable MagicMock object with a list of faked floating ips.
+
+ If floating_ips list is provided, then initialize the Mock object
+ with the list. Otherwise create one.
+
+ :param List floating ips:
+ A list of FakeResource objects faking floating ips
+ :param int count:
+ The number of floating ips to fake
+ :return:
+ An iterable Mock object with side_effect set to a list of faked
+ floating ips
+ """
+ if floating_ips is None:
+ floating_ips = FakeFloatingIP.create_floating_ips(count)
+ return mock.MagicMock(side_effect=floating_ips)
diff --git a/openstackclient/tests/network/v2/test_floating_ip.py b/openstackclient/tests/network/v2/test_floating_ip.py
new file mode 100644
index 00000000..031dcdac
--- /dev/null
+++ b/openstackclient/tests/network/v2/test_floating_ip.py
@@ -0,0 +1,181 @@
+# 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 mock
+
+from openstackclient.network.v2 import floating_ip
+from openstackclient.tests.compute.v2 import fakes as compute_fakes
+from openstackclient.tests.network.v2 import fakes as network_fakes
+
+
+# Tests for Neutron network
+#
+class TestFloatingIPNetwork(network_fakes.TestNetworkV2):
+
+ def setUp(self):
+ super(TestFloatingIPNetwork, self).setUp()
+
+ # Get a shortcut to the network client
+ self.network = self.app.client_manager.network
+
+
+class TestDeleteFloatingIPNetwork(TestFloatingIPNetwork):
+
+ # The floating ip to be deleted.
+ floating_ip = network_fakes.FakeFloatingIP.create_one_floating_ip()
+
+ def setUp(self):
+ super(TestDeleteFloatingIPNetwork, self).setUp()
+
+ self.network.delete_ip = mock.Mock(return_value=self.floating_ip)
+ self.network.find_ip = mock.Mock(return_value=self.floating_ip)
+
+ # Get the command object to test
+ self.cmd = floating_ip.DeleteFloatingIP(self.app, self.namespace)
+
+ def test_floating_ip_delete(self):
+ arglist = [
+ self.floating_ip.id,
+ ]
+ verifylist = [
+ ('floating_ip', self.floating_ip.id),
+ ]
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+
+ result = self.cmd.take_action(parsed_args)
+
+ self.network.find_ip.assert_called_with(self.floating_ip.id)
+ self.network.delete_ip.assert_called_with(self.floating_ip)
+ self.assertIsNone(result)
+
+
+class TestListFloatingIPNetwork(TestFloatingIPNetwork):
+
+ # The floating ips to list up
+ floating_ips = network_fakes.FakeFloatingIP.create_floating_ips(count=3)
+
+ columns = ('ID', 'Floating IP', 'Fixed IP', 'Server ID', 'Pool')
+
+ data = []
+ for ip in floating_ips:
+ data.append((
+ ip.id,
+ ip.ip,
+ ip.fixed_ip,
+ ip.instance_id,
+ ip.pool,
+ ))
+
+ def setUp(self):
+ super(TestListFloatingIPNetwork, self).setUp()
+
+ self.network.ips = mock.Mock(return_value=self.floating_ips)
+
+ # Get the command object to test
+ self.cmd = floating_ip.ListFloatingIP(self.app, self.namespace)
+
+ def test_floating_ip_list(self):
+ arglist = []
+ verifylist = []
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+
+ columns, data = self.cmd.take_action(parsed_args)
+
+ self.network.ips.assert_called_with(**{})
+ self.assertEqual(self.columns, columns)
+ self.assertEqual(self.data, list(data))
+
+
+# Tests for Nova network
+#
+class TestFloatingIPCompute(compute_fakes.TestComputev2):
+
+ def setUp(self):
+ super(TestFloatingIPCompute, self).setUp()
+
+ # Get a shortcut to the compute client
+ self.compute = self.app.client_manager.compute
+
+
+class TestDeleteFloatingIPCompute(TestFloatingIPCompute):
+
+ # The floating ip to be deleted.
+ floating_ip = compute_fakes.FakeFloatingIP.create_one_floating_ip()
+
+ def setUp(self):
+ super(TestDeleteFloatingIPCompute, self).setUp()
+
+ self.app.client_manager.network_endpoint_enabled = False
+
+ self.compute.floating_ips.delete.return_value = None
+
+ # Return value of utils.find_resource()
+ self.compute.floating_ips.get.return_value = self.floating_ip
+
+ # Get the command object to test
+ self.cmd = floating_ip.DeleteFloatingIP(self.app, None)
+
+ def test_floating_ip_delete(self):
+ arglist = [
+ self.floating_ip.id,
+ ]
+ verifylist = [
+ ('floating_ip', self.floating_ip.id),
+ ]
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+
+ result = self.cmd.take_action(parsed_args)
+
+ self.compute.floating_ips.delete.assert_called_with(
+ self.floating_ip.id
+ )
+ self.assertIsNone(result)
+
+
+class TestListFloatingIPCompute(TestFloatingIPCompute):
+
+ # The floating ips to be list up
+ floating_ips = compute_fakes.FakeFloatingIP.create_floating_ips(count=3)
+
+ columns = ('ID', 'Floating IP', 'Fixed IP', 'Server ID', 'Pool')
+
+ data = []
+ for ip in floating_ips:
+ data.append((
+ ip.id,
+ ip.ip,
+ ip.fixed_ip,
+ ip.instance_id,
+ ip.pool,
+ ))
+
+ def setUp(self):
+ super(TestListFloatingIPCompute, self).setUp()
+
+ self.app.client_manager.network_endpoint_enabled = False
+
+ self.compute.floating_ips.list.return_value = self.floating_ips
+
+ # Get the command object to test
+ self.cmd = floating_ip.ListFloatingIP(self.app, None)
+
+ def test_floating_ip_list(self):
+ arglist = []
+ verifylist = []
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+
+ columns, data = self.cmd.take_action(parsed_args)
+
+ self.compute.floating_ips.list.assert_called_with()
+ self.assertEqual(self.columns, columns)
+ self.assertEqual(self.data, list(data))
diff --git a/openstackclient/tests/network/v2/test_network.py b/openstackclient/tests/network/v2/test_network.py
index f96497a4..f7721951 100644
--- a/openstackclient/tests/network/v2/test_network.py
+++ b/openstackclient/tests/network/v2/test_network.py
@@ -17,6 +17,7 @@ import mock
from openstackclient.common import exceptions
from openstackclient.common import utils
from openstackclient.network.v2 import network
+from openstackclient.tests.compute.v2 import fakes as compute_fakes
from openstackclient.tests import fakes
from openstackclient.tests.identity.v2_0 import fakes as identity_fakes_v2
from openstackclient.tests.identity.v3 import fakes as identity_fakes_v3
@@ -24,6 +25,8 @@ from openstackclient.tests.network.v2 import fakes as network_fakes
from openstackclient.tests import utils as tests_utils
+# Tests for Neutron network
+#
class TestNetwork(network_fakes.TestNetworkV2):
def setUp(self):
@@ -103,11 +106,9 @@ class TestCreateNetworkIdentityV3(TestNetwork):
arglist = []
verifylist = []
- try:
- # Missing required args should bail here
- self.check_parser(self.cmd, arglist, verifylist)
- except tests_utils.ParserException:
- pass
+ # Missing required args should bail here
+ self.assertRaises(tests_utils.ParserException, self.check_parser,
+ self.cmd, arglist, verifylist)
def test_create_default_options(self):
arglist = [
@@ -380,7 +381,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 +400,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 +421,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()
@@ -447,7 +454,7 @@ class TestSetNetwork(TestNetwork):
'--share',
]
verifylist = [
- ('identifier', self._network.name),
+ ('network', self._network.name),
('admin_state', True),
('name', 'noob'),
('shared', True),
@@ -471,7 +478,7 @@ class TestSetNetwork(TestNetwork):
'--no-share',
]
verifylist = [
- ('identifier', self._network.name),
+ ('network', self._network.name),
('admin_state', False),
('shared', False),
]
@@ -488,7 +495,7 @@ class TestSetNetwork(TestNetwork):
def test_set_nothing(self):
arglist = [self._network.name, ]
- verifylist = [('identifier', self._network.name), ]
+ verifylist = [('network', self._network.name), ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.assertRaises(exceptions.CommandError, self.cmd.take_action,
@@ -497,7 +504,7 @@ class TestSetNetwork(TestNetwork):
class TestShowNetwork(TestNetwork):
- # The network to set.
+ # The network to show.
_network = network_fakes.FakeNetwork.create_one_network()
columns = (
@@ -536,18 +543,16 @@ class TestShowNetwork(TestNetwork):
arglist = []
verifylist = []
- try:
- # Missing required args should bail here
- self.check_parser(self.cmd, arglist, verifylist)
- except tests_utils.ParserException:
- pass
+ # Missing required args should bail here
+ self.assertRaises(tests_utils.ParserException, self.check_parser,
+ self.cmd, arglist, verifylist)
def test_show_all_options(self):
arglist = [
self._network.name,
]
verifylist = [
- ('identifier', self._network.name),
+ ('network', self._network.name),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@@ -558,3 +563,47 @@ class TestShowNetwork(TestNetwork):
self.assertEqual(tuple(self.columns), columns)
self.assertEqual(list(self.data), list(data))
+
+
+# Tests for Nova network
+#
+class TestNetworkCompute(compute_fakes.TestComputev2):
+
+ def setUp(self):
+ super(TestNetworkCompute, self).setUp()
+
+ # Get a shortcut to the compute client
+ self.compute = self.app.client_manager.compute
+
+
+class TestDeleteNetworkCompute(TestNetworkCompute):
+
+ # The network to delete.
+ _network = network_fakes.FakeNetwork.create_one_network()
+
+ def setUp(self):
+ super(TestDeleteNetworkCompute, self).setUp()
+
+ self.app.client_manager.network_endpoint_enabled = False
+
+ self.compute.networks.delete.return_value = None
+
+ # Return value of utils.find_resource()
+ self.compute.networks.get.return_value = self._network
+
+ # Get the command object to test
+ self.cmd = network.DeleteNetwork(self.app, None)
+
+ def test_network_delete(self):
+ arglist = [
+ self._network.name,
+ ]
+ verifylist = [
+ ('network', [self._network.name]),
+ ]
+
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+ result = self.cmd.take_action(parsed_args)
+
+ self.compute.networks.delete.assert_called_with(self._network.id)
+ self.assertIsNone(result)
diff --git a/openstackclient/tests/network/v2/test_router.py b/openstackclient/tests/network/v2/test_router.py
index 98e9f17a..05bb7857 100644
--- a/openstackclient/tests/network/v2/test_router.py
+++ b/openstackclient/tests/network/v2/test_router.py
@@ -63,10 +63,9 @@ class TestCreateRouter(TestRouter):
arglist = []
verifylist = []
- try:
- self.check_parser(self.cmd, arglist, verifylist)
- except tests_utils.ParserException:
- pass
+ # Missing required args should bail here
+ self.assertRaises(tests_utils.ParserException, self.check_parser,
+ self.cmd, arglist, verifylist)
def test_create_default_options(self):
arglist = [
@@ -201,7 +200,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 +218,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()
@@ -299,11 +302,9 @@ class TestSetRouter(TestRouter):
('distributed', False),
]
- try:
- # Argument parse failing should bail here
- self.check_parser(self.cmd, arglist, verifylist)
- except tests_utils.ParserException:
- pass
+ # Missing required args should bail here
+ self.assertRaises(tests_utils.ParserException, self.check_parser,
+ self.cmd, arglist, verifylist)
def test_set_nothing(self):
arglist = [self._router.name, ]
@@ -349,11 +350,9 @@ class TestShowRouter(TestRouter):
arglist = []
verifylist = []
- try:
- # Missing required args should bail here
- self.check_parser(self.cmd, arglist, verifylist)
- except tests_utils.ParserException:
- pass
+ # Missing required args should bail here
+ self.assertRaises(tests_utils.ParserException, self.check_parser,
+ self.cmd, arglist, verifylist)
def test_show_all_options(self):
arglist = [
diff --git a/openstackclient/tests/object/v1/test_container.py b/openstackclient/tests/object/v1/test_container.py
index d34d73e2..5b0fb48a 100644
--- a/openstackclient/tests/object/v1/test_container.py
+++ b/openstackclient/tests/object/v1/test_container.py
@@ -156,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
@@ -188,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
@@ -222,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
@@ -255,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
@@ -287,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
@@ -328,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
@@ -370,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(