Blacken everything else
Black used with the '-l 79 -S' flags. A future change will ignore this commit in git-blame history by adding a 'git-blame-ignore-revs' file. Change-Id: I356643d06b2cd408ccaedfe02b858aea55388949 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
@@ -19,7 +19,8 @@
|
|||||||
|
|
||||||
# Add any Sphinx extension module names here, as strings. They can be
|
# Add any Sphinx extension module names here, as strings. They can be
|
||||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
||||||
extensions = ['sphinx.ext.autodoc',
|
extensions = [
|
||||||
|
'sphinx.ext.autodoc',
|
||||||
'sphinx.ext.doctest',
|
'sphinx.ext.doctest',
|
||||||
'sphinx.ext.todo',
|
'sphinx.ext.todo',
|
||||||
'openstackdocstheme',
|
'openstackdocstheme',
|
||||||
@@ -176,10 +177,8 @@ html_extra_path = ['_extra']
|
|||||||
latex_elements = {
|
latex_elements = {
|
||||||
# The paper size ('letterpaper' or 'a4paper').
|
# The paper size ('letterpaper' or 'a4paper').
|
||||||
#'papersize': 'letterpaper',
|
#'papersize': 'letterpaper',
|
||||||
|
|
||||||
# The font size ('10pt', '11pt' or '12pt').
|
# The font size ('10pt', '11pt' or '12pt').
|
||||||
#'pointsize': '10pt',
|
#'pointsize': '10pt',
|
||||||
|
|
||||||
# Additional stuff for the LaTeX preamble.
|
# Additional stuff for the LaTeX preamble.
|
||||||
#'preamble': '',
|
#'preamble': '',
|
||||||
}
|
}
|
||||||
@@ -188,9 +187,13 @@ latex_elements = {
|
|||||||
# (source start file, target name, title, author, documentclass [howto/manual])
|
# (source start file, target name, title, author, documentclass [howto/manual])
|
||||||
# .
|
# .
|
||||||
latex_documents = [
|
latex_documents = [
|
||||||
('index', 'OpenStackCommandLineClient.tex',
|
(
|
||||||
|
'index',
|
||||||
|
'OpenStackCommandLineClient.tex',
|
||||||
'OpenStack Command Line Client Documentation',
|
'OpenStack Command Line Client Documentation',
|
||||||
'OpenStack', 'manual'),
|
'OpenStack',
|
||||||
|
'manual',
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
# The name of an image file (relative to this directory) to place at the top of
|
# The name of an image file (relative to this directory) to place at the top of
|
||||||
@@ -238,11 +241,15 @@ man_pages = [
|
|||||||
# (source start file, target name, title, author,
|
# (source start file, target name, title, author,
|
||||||
# dir menu entry, description, category)
|
# dir menu entry, description, category)
|
||||||
texinfo_documents = [
|
texinfo_documents = [
|
||||||
('index', 'OpenStackCommandLineClient',
|
(
|
||||||
|
'index',
|
||||||
|
'OpenStackCommandLineClient',
|
||||||
'OpenStack Command Line Client Documentation',
|
'OpenStack Command Line Client Documentation',
|
||||||
'OpenStack', 'OpenStackCommandLineClient',
|
'OpenStack',
|
||||||
|
'OpenStackCommandLineClient',
|
||||||
'One line description of project.',
|
'One line description of project.',
|
||||||
'Miscellaneous'),
|
'Miscellaneous',
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
# Documents to append as an appendix to all manuals.
|
# Documents to append as an appendix to all manuals.
|
||||||
@@ -260,8 +267,16 @@ texinfo_documents = [
|
|||||||
autoprogram_cliff_application = 'openstack'
|
autoprogram_cliff_application = 'openstack'
|
||||||
|
|
||||||
autoprogram_cliff_ignored = [
|
autoprogram_cliff_ignored = [
|
||||||
'--help', '--format', '--column', '--max-width', '--fit-width',
|
'--help',
|
||||||
'--print-empty', '--prefix', '--noindent', '--quote']
|
'--format',
|
||||||
|
'--column',
|
||||||
|
'--max-width',
|
||||||
|
'--fit-width',
|
||||||
|
'--print-empty',
|
||||||
|
'--prefix',
|
||||||
|
'--noindent',
|
||||||
|
'--quote',
|
||||||
|
]
|
||||||
|
|
||||||
# Prevent cliff from generating "This command is provided by the
|
# Prevent cliff from generating "This command is provided by the
|
||||||
# python-openstackclient plugin."
|
# python-openstackclient plugin."
|
||||||
|
@@ -57,6 +57,7 @@ dump_stack_trace = False
|
|||||||
|
|
||||||
# Generally useful stuff often found in a utils module
|
# Generally useful stuff often found in a utils module
|
||||||
|
|
||||||
|
|
||||||
def env(*vars, **kwargs):
|
def env(*vars, **kwargs):
|
||||||
"""Search for the first defined of possibly many env vars
|
"""Search for the first defined of possibly many env vars
|
||||||
|
|
||||||
@@ -73,6 +74,7 @@ def env(*vars, **kwargs):
|
|||||||
|
|
||||||
# Common Example functions
|
# Common Example functions
|
||||||
|
|
||||||
|
|
||||||
def base_parser(parser):
|
def base_parser(parser):
|
||||||
"""Set up some of the common CLI options
|
"""Set up some of the common CLI options
|
||||||
|
|
||||||
@@ -128,7 +130,8 @@ def base_parser(parser):
|
|||||||
help="Print API call timing info",
|
help="Print API call timing info",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-v', '--verbose',
|
'-v',
|
||||||
|
'--verbose',
|
||||||
action='count',
|
action='count',
|
||||||
dest='verbose_level',
|
dest='verbose_level',
|
||||||
default=1,
|
default=1,
|
||||||
@@ -225,16 +228,14 @@ def make_session(opts, **kwargs):
|
|||||||
)
|
)
|
||||||
auth_p = auth_plugin.load_from_options(**auth_params)
|
auth_p = auth_plugin.load_from_options(**auth_params)
|
||||||
|
|
||||||
session = ks_session.Session(
|
session = ks_session.Session(auth=auth_p, **kwargs)
|
||||||
auth=auth_p,
|
|
||||||
**kwargs
|
|
||||||
)
|
|
||||||
|
|
||||||
return session
|
return session
|
||||||
|
|
||||||
|
|
||||||
# Top-level functions
|
# Top-level functions
|
||||||
|
|
||||||
|
|
||||||
def run(opts):
|
def run(opts):
|
||||||
"""Default run command"""
|
"""Default run command"""
|
||||||
|
|
||||||
|
@@ -31,14 +31,13 @@ DEFAULT_DOMAIN = 'default'
|
|||||||
|
|
||||||
|
|
||||||
class OpenStackShell(shell.OpenStackShell):
|
class OpenStackShell(shell.OpenStackShell):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
||||||
super(OpenStackShell, self).__init__(
|
super(OpenStackShell, self).__init__(
|
||||||
description=__doc__.strip(),
|
description=__doc__.strip(),
|
||||||
version=openstackclient.__version__,
|
version=openstackclient.__version__,
|
||||||
command_manager=commandmanager.CommandManager('openstack.cli'),
|
command_manager=commandmanager.CommandManager('openstack.cli'),
|
||||||
deferred_help=True)
|
deferred_help=True,
|
||||||
|
)
|
||||||
|
|
||||||
self.api_version = {}
|
self.api_version = {}
|
||||||
|
|
||||||
@@ -51,8 +50,8 @@ class OpenStackShell(shell.OpenStackShell):
|
|||||||
|
|
||||||
def build_option_parser(self, description, version):
|
def build_option_parser(self, description, version):
|
||||||
parser = super(OpenStackShell, self).build_option_parser(
|
parser = super(OpenStackShell, self).build_option_parser(
|
||||||
description,
|
description, version
|
||||||
version)
|
)
|
||||||
parser = clientmanager.build_plugin_option_parser(parser)
|
parser = clientmanager.build_plugin_option_parser(parser)
|
||||||
parser = auth.build_auth_plugins_option_parser(parser)
|
parser = auth.build_auth_plugins_option_parser(parser)
|
||||||
return parser
|
return parser
|
||||||
@@ -61,7 +60,7 @@ class OpenStackShell(shell.OpenStackShell):
|
|||||||
super(OpenStackShell, self)._final_defaults()
|
super(OpenStackShell, self)._final_defaults()
|
||||||
|
|
||||||
# Set the default plugin to admin_token if endpoint and token are given
|
# Set the default plugin to admin_token if endpoint and token are given
|
||||||
if (self.options.endpoint and self.options.token):
|
if self.options.endpoint and self.options.token:
|
||||||
# Use token authentication
|
# Use token authentication
|
||||||
self._auth_type = 'admin_token'
|
self._auth_type = 'admin_token'
|
||||||
else:
|
else:
|
||||||
@@ -96,10 +95,12 @@ class OpenStackShell(shell.OpenStackShell):
|
|||||||
if version_opt not in mod_versions:
|
if version_opt not in mod_versions:
|
||||||
sorted_versions = sorted(
|
sorted_versions = sorted(
|
||||||
mod.API_VERSIONS.keys(),
|
mod.API_VERSIONS.keys(),
|
||||||
key=lambda s: list(map(int, s.split('.'))))
|
key=lambda s: list(map(int, s.split('.'))),
|
||||||
|
)
|
||||||
self.log.warning(
|
self.log.warning(
|
||||||
"%s version %s is not in supported versions: %s"
|
"%s version %s is not in supported versions: %s"
|
||||||
% (api, version_opt, ', '.join(sorted_versions)))
|
% (api, version_opt, ', '.join(sorted_versions))
|
||||||
|
)
|
||||||
|
|
||||||
# Command groups deal only with major versions
|
# Command groups deal only with major versions
|
||||||
version = '.v' + version_opt.replace('.', '_').split('_')[0]
|
version = '.v' + version_opt.replace('.', '_').split('_')[0]
|
||||||
@@ -107,7 +108,7 @@ class OpenStackShell(shell.OpenStackShell):
|
|||||||
self.command_manager.add_command_group(cmd_group)
|
self.command_manager.add_command_group(cmd_group)
|
||||||
self.log.debug(
|
self.log.debug(
|
||||||
'%(name)s API version %(version)s, cmd group %(group)s',
|
'%(name)s API version %(version)s, cmd group %(group)s',
|
||||||
{'name': api, 'version': version_opt, 'group': cmd_group}
|
{'name': api, 'version': version_opt, 'group': cmd_group},
|
||||||
)
|
)
|
||||||
|
|
||||||
def _load_commands(self):
|
def _load_commands(self):
|
||||||
@@ -116,8 +117,7 @@ class OpenStackShell(shell.OpenStackShell):
|
|||||||
osc-lib has no opinion on what commands should be loaded
|
osc-lib has no opinion on what commands should be loaded
|
||||||
"""
|
"""
|
||||||
# Commands that span multiple APIs
|
# Commands that span multiple APIs
|
||||||
self.command_manager.add_command_group(
|
self.command_manager.add_command_group('openstack.common')
|
||||||
'openstack.common')
|
|
||||||
|
|
||||||
# This is the naive extension implementation referred to in
|
# This is the naive extension implementation referred to in
|
||||||
# blueprint 'client-extensions'
|
# blueprint 'client-extensions'
|
||||||
@@ -129,8 +129,7 @@ class OpenStackShell(shell.OpenStackShell):
|
|||||||
# 'show_repo=qaz.github.repo:ShowRepo',
|
# 'show_repo=qaz.github.repo:ShowRepo',
|
||||||
# ],
|
# ],
|
||||||
# }
|
# }
|
||||||
self.command_manager.add_command_group(
|
self.command_manager.add_command_group('openstack.extension')
|
||||||
'openstack.extension')
|
|
||||||
|
|
||||||
def initialize_app(self, argv):
|
def initialize_app(self, argv):
|
||||||
super(OpenStackShell, self).initialize_app(argv)
|
super(OpenStackShell, self).initialize_app(argv)
|
||||||
|
@@ -40,14 +40,16 @@ def execute(cmd, fail_ok=False, merge_stderr=False):
|
|||||||
|
|
||||||
if not fail_ok and proc.returncode != 0:
|
if not fail_ok and proc.returncode != 0:
|
||||||
raise exceptions.CommandFailed(
|
raise exceptions.CommandFailed(
|
||||||
proc.returncode, cmd, result_out, result_err,
|
proc.returncode,
|
||||||
|
cmd,
|
||||||
|
result_out,
|
||||||
|
result_err,
|
||||||
)
|
)
|
||||||
|
|
||||||
return result_out
|
return result_out
|
||||||
|
|
||||||
|
|
||||||
class TestCase(testtools.TestCase):
|
class TestCase(testtools.TestCase):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def openstack(
|
def openstack(
|
||||||
cls,
|
cls,
|
||||||
@@ -128,8 +130,9 @@ class TestCase(testtools.TestCase):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_opts(cls, fields, output_format='value'):
|
def get_opts(cls, fields, output_format='value'):
|
||||||
return ' -f {0} {1}'.format(output_format,
|
return ' -f {0} {1}'.format(
|
||||||
' '.join(['-c ' + it for it in fields]))
|
output_format, ' '.join(['-c ' + it for it in fields])
|
||||||
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def assertOutput(cls, expected, actual):
|
def assertOutput(cls, expected, actual):
|
||||||
|
@@ -29,8 +29,7 @@ REGION_NAME = "richie"
|
|||||||
INTERFACE = "catchy"
|
INTERFACE = "catchy"
|
||||||
VERSION = "3"
|
VERSION = "3"
|
||||||
|
|
||||||
TEST_RESPONSE_DICT = fixture.V2Token(token_id=AUTH_TOKEN,
|
TEST_RESPONSE_DICT = fixture.V2Token(token_id=AUTH_TOKEN, user_name=USERNAME)
|
||||||
user_name=USERNAME)
|
|
||||||
_s = TEST_RESPONSE_DICT.add_service('identity', name='keystone')
|
_s = TEST_RESPONSE_DICT.add_service('identity', name='keystone')
|
||||||
_s.add_endpoint(AUTH_URL + ':5000/v2.0')
|
_s.add_endpoint(AUTH_URL + ':5000/v2.0')
|
||||||
_s = TEST_RESPONSE_DICT.add_service('network', name='neutron')
|
_s = TEST_RESPONSE_DICT.add_service('network', name='neutron')
|
||||||
@@ -49,7 +48,6 @@ TEST_VERSIONS = fixture.DiscoveryList(href=AUTH_URL)
|
|||||||
|
|
||||||
|
|
||||||
class FakeStdout(object):
|
class FakeStdout(object):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.content = []
|
self.content = []
|
||||||
|
|
||||||
@@ -64,7 +62,6 @@ class FakeStdout(object):
|
|||||||
|
|
||||||
|
|
||||||
class FakeLog(object):
|
class FakeLog(object):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.messages = {}
|
self.messages = {}
|
||||||
|
|
||||||
@@ -85,7 +82,6 @@ class FakeLog(object):
|
|||||||
|
|
||||||
|
|
||||||
class FakeApp(object):
|
class FakeApp(object):
|
||||||
|
|
||||||
def __init__(self, _stdout, _log):
|
def __init__(self, _stdout, _log):
|
||||||
self.stdout = _stdout
|
self.stdout = _stdout
|
||||||
self.client_manager = None
|
self.client_manager = None
|
||||||
@@ -102,7 +98,6 @@ class FakeOptions(object):
|
|||||||
|
|
||||||
|
|
||||||
class FakeClient(object):
|
class FakeClient(object):
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
self.endpoint = kwargs['endpoint']
|
self.endpoint = kwargs['endpoint']
|
||||||
self.token = kwargs['token']
|
self.token = kwargs['token']
|
||||||
@@ -131,7 +126,6 @@ class FakeClientManager(object):
|
|||||||
self.configuration_type = 'cloud_config'
|
self.configuration_type = 'cloud_config'
|
||||||
|
|
||||||
def get_configuration(self):
|
def get_configuration(self):
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
'region': REGION_NAME,
|
'region': REGION_NAME,
|
||||||
'identity_api_version': VERSION,
|
'identity_api_version': VERSION,
|
||||||
@@ -161,7 +155,6 @@ class FakeClientManager(object):
|
|||||||
|
|
||||||
|
|
||||||
class FakeModule(object):
|
class FakeModule(object):
|
||||||
|
|
||||||
def __init__(self, name, version):
|
def __init__(self, name, version):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.__version__ = version
|
self.__version__ = version
|
||||||
@@ -171,7 +164,6 @@ class FakeModule(object):
|
|||||||
|
|
||||||
|
|
||||||
class FakeResource(object):
|
class FakeResource(object):
|
||||||
|
|
||||||
def __init__(self, manager=None, info=None, loaded=False, methods=None):
|
def __init__(self, manager=None, info=None, loaded=False, methods=None):
|
||||||
"""Set attributes and methods for a resource.
|
"""Set attributes and methods for a resource.
|
||||||
|
|
||||||
@@ -195,7 +187,7 @@ class FakeResource(object):
|
|||||||
self._loaded = loaded
|
self._loaded = loaded
|
||||||
|
|
||||||
def _add_details(self, info):
|
def _add_details(self, info):
|
||||||
for (k, v) in info.items():
|
for k, v in info.items():
|
||||||
setattr(self, k, v)
|
setattr(self, k, v)
|
||||||
|
|
||||||
def _add_methods(self, methods):
|
def _add_methods(self, methods):
|
||||||
@@ -206,13 +198,14 @@ class FakeResource(object):
|
|||||||
@value. When users access the attribute with (), @value will be
|
@value. When users access the attribute with (), @value will be
|
||||||
returned, which looks like a function call.
|
returned, which looks like a function call.
|
||||||
"""
|
"""
|
||||||
for (name, ret) in methods.items():
|
for name, ret in methods.items():
|
||||||
method = mock.Mock(return_value=ret)
|
method = mock.Mock(return_value=ret)
|
||||||
setattr(self, name, method)
|
setattr(self, name, method)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
reprkeys = sorted(k for k in self.__dict__.keys() if k[0] != '_' and
|
reprkeys = sorted(
|
||||||
k != 'manager')
|
k for k in self.__dict__.keys() if k[0] != '_' and k != 'manager'
|
||||||
|
)
|
||||||
info = ", ".join("%s=%s" % (k, getattr(self, k)) for k in reprkeys)
|
info = ", ".join("%s=%s" % (k, getattr(self, k)) for k in reprkeys)
|
||||||
return "<%s %s>" % (self.__class__.__name__, info)
|
return "<%s %s>" % (self.__class__.__name__, info)
|
||||||
|
|
||||||
@@ -237,9 +230,9 @@ class FakeResource(object):
|
|||||||
|
|
||||||
|
|
||||||
class FakeResponse(requests.Response):
|
class FakeResponse(requests.Response):
|
||||||
|
def __init__(
|
||||||
def __init__(self, headers=None, status_code=200,
|
self, headers=None, status_code=200, data=None, encoding=None
|
||||||
data=None, encoding=None):
|
):
|
||||||
super(FakeResponse, self).__init__()
|
super(FakeResponse, self).__init__()
|
||||||
|
|
||||||
headers = headers or {}
|
headers = headers or {}
|
||||||
@@ -253,7 +246,6 @@ class FakeResponse(requests.Response):
|
|||||||
|
|
||||||
|
|
||||||
class FakeModel(dict):
|
class FakeModel(dict):
|
||||||
|
|
||||||
def __getattr__(self, key):
|
def __getattr__(self, key):
|
||||||
try:
|
try:
|
||||||
return self[key]
|
return self[key]
|
||||||
|
@@ -51,15 +51,19 @@ V3_VERSION_RESP = {
|
|||||||
"version": {
|
"version": {
|
||||||
"status": "stable",
|
"status": "stable",
|
||||||
"updated": "2016-04-04T00:00:00Z",
|
"updated": "2016-04-04T00:00:00Z",
|
||||||
"media-types": [{
|
"media-types": [
|
||||||
|
{
|
||||||
"base": "application/json",
|
"base": "application/json",
|
||||||
"type": "application/vnd.openstack.identity-v3+json",
|
"type": "application/vnd.openstack.identity-v3+json",
|
||||||
}],
|
}
|
||||||
|
],
|
||||||
"id": "v3.6",
|
"id": "v3.6",
|
||||||
"links": [{
|
"links": [
|
||||||
|
{
|
||||||
"href": V3_AUTH_URL,
|
"href": V3_AUTH_URL,
|
||||||
"rel": "self",
|
"rel": "self",
|
||||||
}]
|
}
|
||||||
|
],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,7 +118,6 @@ def make_v3_token(req_mock):
|
|||||||
|
|
||||||
|
|
||||||
class TestInteg(utils.TestCase):
|
class TestInteg(utils.TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestInteg, self).setUp()
|
super(TestInteg, self).setUp()
|
||||||
|
|
||||||
|
@@ -20,7 +20,6 @@ from openstackclient.tests.unit import test_shell
|
|||||||
|
|
||||||
|
|
||||||
class TestIntegV2ProjectID(test_base.TestInteg):
|
class TestIntegV2ProjectID(test_base.TestInteg):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestIntegV2ProjectID, self).setUp()
|
super(TestIntegV2ProjectID, self).setUp()
|
||||||
env = {
|
env = {
|
||||||
@@ -78,7 +77,6 @@ class TestIntegV2ProjectID(test_base.TestInteg):
|
|||||||
|
|
||||||
|
|
||||||
class TestIntegV2ProjectName(test_base.TestInteg):
|
class TestIntegV2ProjectName(test_base.TestInteg):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestIntegV2ProjectName, self).setUp()
|
super(TestIntegV2ProjectName, self).setUp()
|
||||||
env = {
|
env = {
|
||||||
@@ -136,7 +134,6 @@ class TestIntegV2ProjectName(test_base.TestInteg):
|
|||||||
|
|
||||||
|
|
||||||
class TestIntegV3ProjectID(test_base.TestInteg):
|
class TestIntegV3ProjectID(test_base.TestInteg):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestIntegV3ProjectID, self).setUp()
|
super(TestIntegV3ProjectID, self).setUp()
|
||||||
env = {
|
env = {
|
||||||
@@ -192,7 +189,6 @@ class TestIntegV3ProjectID(test_base.TestInteg):
|
|||||||
|
|
||||||
|
|
||||||
class TestIntegV3ProjectName(test_base.TestInteg):
|
class TestIntegV3ProjectName(test_base.TestInteg):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestIntegV3ProjectName, self).setUp()
|
super(TestIntegV3ProjectName, self).setUp()
|
||||||
env = {
|
env = {
|
||||||
|
@@ -22,7 +22,6 @@ from openstackclient.tests.unit import test_shell
|
|||||||
|
|
||||||
|
|
||||||
class TestIntegShellCliNoAuth(test_base.TestInteg):
|
class TestIntegShellCliNoAuth(test_base.TestInteg):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestIntegShellCliNoAuth, self).setUp()
|
super(TestIntegShellCliNoAuth, self).setUp()
|
||||||
env = {}
|
env = {}
|
||||||
@@ -67,7 +66,6 @@ class TestIntegShellCliNoAuth(test_base.TestInteg):
|
|||||||
|
|
||||||
|
|
||||||
class TestIntegShellCliV2(test_base.TestInteg):
|
class TestIntegShellCliV2(test_base.TestInteg):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestIntegShellCliV2, self).setUp()
|
super(TestIntegShellCliV2, self).setUp()
|
||||||
env = {
|
env = {
|
||||||
@@ -155,7 +153,6 @@ class TestIntegShellCliV2(test_base.TestInteg):
|
|||||||
|
|
||||||
|
|
||||||
class TestIntegShellCliV2Ignore(test_base.TestInteg):
|
class TestIntegShellCliV2Ignore(test_base.TestInteg):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestIntegShellCliV2Ignore, self).setUp()
|
super(TestIntegShellCliV2Ignore, self).setUp()
|
||||||
env = {
|
env = {
|
||||||
@@ -202,7 +199,6 @@ class TestIntegShellCliV2Ignore(test_base.TestInteg):
|
|||||||
|
|
||||||
|
|
||||||
class TestIntegShellCliV3(test_base.TestInteg):
|
class TestIntegShellCliV3(test_base.TestInteg):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestIntegShellCliV3, self).setUp()
|
super(TestIntegShellCliV3, self).setUp()
|
||||||
env = {
|
env = {
|
||||||
@@ -293,7 +289,6 @@ class TestIntegShellCliV3(test_base.TestInteg):
|
|||||||
|
|
||||||
|
|
||||||
class TestIntegShellCliV3Prompt(test_base.TestInteg):
|
class TestIntegShellCliV3Prompt(test_base.TestInteg):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestIntegShellCliV3Prompt, self).setUp()
|
super(TestIntegShellCliV3Prompt, self).setUp()
|
||||||
env = {
|
env = {
|
||||||
@@ -318,8 +313,7 @@ class TestIntegShellCliV3Prompt(test_base.TestInteg):
|
|||||||
|
|
||||||
# Check password callback set correctly
|
# Check password callback set correctly
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
mock_prompt,
|
mock_prompt, _shell.cloud._openstack_config._pw_callback
|
||||||
_shell.cloud._openstack_config._pw_callback
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Check auth request
|
# Check auth request
|
||||||
@@ -358,8 +352,9 @@ class TestIntegShellCliPrecedence(test_base.TestInteg):
|
|||||||
self.token = test_base.make_v3_token(self.requests_mock)
|
self.token = test_base.make_v3_token(self.requests_mock)
|
||||||
|
|
||||||
# Patch a v3 auth URL into the o-c-c data
|
# Patch a v3 auth URL into the o-c-c data
|
||||||
test_shell.PUBLIC_1['public-clouds']['megadodo']['auth']['auth_url'] \
|
test_shell.PUBLIC_1['public-clouds']['megadodo']['auth'][
|
||||||
= test_base.V3_AUTH_URL
|
'auth_url'
|
||||||
|
] = test_base.V3_AUTH_URL
|
||||||
|
|
||||||
def test_shell_args_options(self):
|
def test_shell_args_options(self):
|
||||||
"""Verify command line options override environment variables"""
|
"""Verify command line options override environment variables"""
|
||||||
@@ -432,8 +427,9 @@ class TestIntegShellCliPrecedenceOCC(test_base.TestInteg):
|
|||||||
self.token = test_base.make_v3_token(self.requests_mock)
|
self.token = test_base.make_v3_token(self.requests_mock)
|
||||||
|
|
||||||
# Patch a v3 auth URL into the o-c-c data
|
# Patch a v3 auth URL into the o-c-c data
|
||||||
test_shell.PUBLIC_1['public-clouds']['megadodo']['auth']['auth_url'] \
|
test_shell.PUBLIC_1['public-clouds']['megadodo']['auth'][
|
||||||
= test_base.V3_AUTH_URL
|
'auth_url'
|
||||||
|
] = test_base.V3_AUTH_URL
|
||||||
|
|
||||||
def get_temp_file_path(self, filename):
|
def get_temp_file_path(self, filename):
|
||||||
"""Returns an absolute path for a temporary file.
|
"""Returns an absolute path for a temporary file.
|
||||||
@@ -457,10 +453,12 @@ class TestIntegShellCliPrecedenceOCC(test_base.TestInteg):
|
|||||||
log_file = self.get_temp_file_path('test_log_file')
|
log_file = self.get_temp_file_path('test_log_file')
|
||||||
cloud2 = test_shell.get_cloud(log_file)
|
cloud2 = test_shell.get_cloud(log_file)
|
||||||
return ('file.yaml', cloud2)
|
return ('file.yaml', cloud2)
|
||||||
|
|
||||||
config_mock.side_effect = config_mock_return
|
config_mock.side_effect = config_mock_return
|
||||||
|
|
||||||
def vendor_mock_return():
|
def vendor_mock_return():
|
||||||
return ('file.yaml', copy.deepcopy(test_shell.PUBLIC_1))
|
return ('file.yaml', copy.deepcopy(test_shell.PUBLIC_1))
|
||||||
|
|
||||||
vendor_mock.side_effect = vendor_mock_return
|
vendor_mock.side_effect = vendor_mock_return
|
||||||
|
|
||||||
_shell = shell.OpenStackShell()
|
_shell = shell.OpenStackShell()
|
||||||
@@ -528,10 +526,12 @@ class TestIntegShellCliPrecedenceOCC(test_base.TestInteg):
|
|||||||
log_file = self.get_temp_file_path('test_log_file')
|
log_file = self.get_temp_file_path('test_log_file')
|
||||||
cloud2 = test_shell.get_cloud(log_file)
|
cloud2 = test_shell.get_cloud(log_file)
|
||||||
return ('file.yaml', cloud2)
|
return ('file.yaml', cloud2)
|
||||||
|
|
||||||
config_mock.side_effect = config_mock_return
|
config_mock.side_effect = config_mock_return
|
||||||
|
|
||||||
def vendor_mock_return():
|
def vendor_mock_return():
|
||||||
return ('file.yaml', copy.deepcopy(test_shell.PUBLIC_1))
|
return ('file.yaml', copy.deepcopy(test_shell.PUBLIC_1))
|
||||||
|
|
||||||
vendor_mock.side_effect = vendor_mock_return
|
vendor_mock.side_effect = vendor_mock_return
|
||||||
|
|
||||||
_shell = shell.OpenStackShell()
|
_shell = shell.OpenStackShell()
|
||||||
|
@@ -96,7 +96,7 @@ global_options = {
|
|||||||
'--os-cacert': ('/dev/null', True, True),
|
'--os-cacert': ('/dev/null', True, True),
|
||||||
'--timing': (True, True, False),
|
'--timing': (True, True, False),
|
||||||
'--os-profile': ('SECRET_KEY', True, False),
|
'--os-profile': ('SECRET_KEY', True, False),
|
||||||
'--os-interface': (DEFAULT_INTERFACE, True, True)
|
'--os-interface': (DEFAULT_INTERFACE, True, True),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -138,7 +138,6 @@ wrapt.wrap_function_wrapper(
|
|||||||
|
|
||||||
|
|
||||||
class TestShell(osc_lib_test_utils.TestShell):
|
class TestShell(osc_lib_test_utils.TestShell):
|
||||||
|
|
||||||
# Full name of the OpenStackShell class to test (cliff.app.App subclass)
|
# Full name of the OpenStackShell class to test (cliff.app.App subclass)
|
||||||
shell_class_name = "openstackclient.shell.OpenStackShell"
|
shell_class_name = "openstackclient.shell.OpenStackShell"
|
||||||
|
|
||||||
@@ -191,14 +190,12 @@ class TestShell(osc_lib_test_utils.TestShell):
|
|||||||
|
|
||||||
self.app.assert_called_with(["list", "role"])
|
self.app.assert_called_with(["list", "role"])
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
default_args.get("token", ''),
|
default_args.get("token", ''), _shell.options.token, "token"
|
||||||
_shell.options.token,
|
|
||||||
"token"
|
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
default_args.get("auth_url", ''),
|
default_args.get("auth_url", ''),
|
||||||
_shell.options.auth_url,
|
_shell.options.auth_url,
|
||||||
"auth_url"
|
"auth_url",
|
||||||
)
|
)
|
||||||
|
|
||||||
def _assert_cli(self, cmd_options, default_args):
|
def _assert_cli(self, cmd_options, default_args):
|
||||||
@@ -213,20 +210,29 @@ class TestShell(osc_lib_test_utils.TestShell):
|
|||||||
osc_lib_test_utils.fake_execute(_shell, _cmd)
|
osc_lib_test_utils.fake_execute(_shell, _cmd)
|
||||||
|
|
||||||
self.app.assert_called_with(["list", "server"])
|
self.app.assert_called_with(["list", "server"])
|
||||||
self.assertEqual(default_args["compute_api_version"],
|
self.assertEqual(
|
||||||
_shell.options.os_compute_api_version)
|
default_args["compute_api_version"],
|
||||||
self.assertEqual(default_args["identity_api_version"],
|
_shell.options.os_compute_api_version,
|
||||||
_shell.options.os_identity_api_version)
|
)
|
||||||
self.assertEqual(default_args["image_api_version"],
|
self.assertEqual(
|
||||||
_shell.options.os_image_api_version)
|
default_args["identity_api_version"],
|
||||||
self.assertEqual(default_args["volume_api_version"],
|
_shell.options.os_identity_api_version,
|
||||||
_shell.options.os_volume_api_version)
|
)
|
||||||
self.assertEqual(default_args["network_api_version"],
|
self.assertEqual(
|
||||||
_shell.options.os_network_api_version)
|
default_args["image_api_version"],
|
||||||
|
_shell.options.os_image_api_version,
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
default_args["volume_api_version"],
|
||||||
|
_shell.options.os_volume_api_version,
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
default_args["network_api_version"],
|
||||||
|
_shell.options.os_network_api_version,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class TestShellOptions(TestShell):
|
class TestShellOptions(TestShell):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestShellOptions, self).setUp()
|
super(TestShellOptions, self).setUp()
|
||||||
self.useFixture(osc_lib_test_utils.EnvFixture())
|
self.useFixture(osc_lib_test_utils.EnvFixture())
|
||||||
@@ -289,7 +295,6 @@ class TestShellOptions(TestShell):
|
|||||||
|
|
||||||
|
|
||||||
class TestShellTokenAuthEnv(TestShell):
|
class TestShellTokenAuthEnv(TestShell):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestShellTokenAuthEnv, self).setUp()
|
super(TestShellTokenAuthEnv, self).setUp()
|
||||||
env = {
|
env = {
|
||||||
@@ -333,7 +338,6 @@ class TestShellTokenAuthEnv(TestShell):
|
|||||||
|
|
||||||
|
|
||||||
class TestShellTokenEndpointAuthEnv(TestShell):
|
class TestShellTokenEndpointAuthEnv(TestShell):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestShellTokenEndpointAuthEnv, self).setUp()
|
super(TestShellTokenEndpointAuthEnv, self).setUp()
|
||||||
env = {
|
env = {
|
||||||
@@ -377,7 +381,6 @@ class TestShellTokenEndpointAuthEnv(TestShell):
|
|||||||
|
|
||||||
|
|
||||||
class TestShellCli(TestShell):
|
class TestShellCli(TestShell):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestShellCli, self).setUp()
|
super(TestShellCli, self).setUp()
|
||||||
env = {
|
env = {
|
||||||
@@ -408,6 +411,6 @@ class TestShellCli(TestShell):
|
|||||||
"identity_api_version": LIB_IDENTITY_API_VERSION,
|
"identity_api_version": LIB_IDENTITY_API_VERSION,
|
||||||
"image_api_version": LIB_IMAGE_API_VERSION,
|
"image_api_version": LIB_IMAGE_API_VERSION,
|
||||||
"volume_api_version": LIB_VOLUME_API_VERSION,
|
"volume_api_version": LIB_VOLUME_API_VERSION,
|
||||||
"network_api_version": LIB_NETWORK_API_VERSION
|
"network_api_version": LIB_NETWORK_API_VERSION,
|
||||||
}
|
}
|
||||||
self._assert_cli(flag, kwargs)
|
self._assert_cli(flag, kwargs)
|
||||||
|
@@ -29,22 +29,26 @@ class ParserException(Exception):
|
|||||||
|
|
||||||
class CompareBySet(list):
|
class CompareBySet(list):
|
||||||
"""Class to compare value using set."""
|
"""Class to compare value using set."""
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return set(self) == set(other)
|
return set(self) == set(other)
|
||||||
|
|
||||||
|
|
||||||
class TestCase(testtools.TestCase):
|
class TestCase(testtools.TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
testtools.TestCase.setUp(self)
|
testtools.TestCase.setUp(self)
|
||||||
|
|
||||||
if (os.environ.get("OS_STDOUT_CAPTURE") == "True" or
|
if (
|
||||||
os.environ.get("OS_STDOUT_CAPTURE") == "1"):
|
os.environ.get("OS_STDOUT_CAPTURE") == "True"
|
||||||
|
or os.environ.get("OS_STDOUT_CAPTURE") == "1"
|
||||||
|
):
|
||||||
stdout = self.useFixture(fixtures.StringStream("stdout")).stream
|
stdout = self.useFixture(fixtures.StringStream("stdout")).stream
|
||||||
self.useFixture(fixtures.MonkeyPatch("sys.stdout", stdout))
|
self.useFixture(fixtures.MonkeyPatch("sys.stdout", stdout))
|
||||||
|
|
||||||
if (os.environ.get("OS_STDERR_CAPTURE") == "True" or
|
if (
|
||||||
os.environ.get("OS_STDERR_CAPTURE") == "1"):
|
os.environ.get("OS_STDERR_CAPTURE") == "True"
|
||||||
|
or os.environ.get("OS_STDERR_CAPTURE") == "1"
|
||||||
|
):
|
||||||
stderr = self.useFixture(fixtures.StringStream("stderr")).stream
|
stderr = self.useFixture(fixtures.StringStream("stderr")).stream
|
||||||
self.useFixture(fixtures.MonkeyPatch("sys.stderr", stderr))
|
self.useFixture(fixtures.MonkeyPatch("sys.stderr", stderr))
|
||||||
|
|
||||||
@@ -76,8 +80,9 @@ class TestCommand(TestCase):
|
|||||||
try:
|
try:
|
||||||
parsed_args = cmd_parser.parse_args(args)
|
parsed_args = cmd_parser.parse_args(args)
|
||||||
except SystemExit:
|
except SystemExit:
|
||||||
raise ParserException("Argument parse failed: %s" %
|
raise ParserException(
|
||||||
stderr.getvalue())
|
"Argument parse failed: %s" % stderr.getvalue()
|
||||||
|
)
|
||||||
for av in verify_args:
|
for av in verify_args:
|
||||||
attr, value = av
|
attr, value = av
|
||||||
if attr:
|
if attr:
|
||||||
|
@@ -224,10 +224,8 @@ htmlhelp_basename = 'OpenStackClientReleaseNotesdoc'
|
|||||||
latex_elements = {
|
latex_elements = {
|
||||||
# The paper size ('letterpaper' or 'a4paper').
|
# The paper size ('letterpaper' or 'a4paper').
|
||||||
# 'papersize': 'letterpaper',
|
# 'papersize': 'letterpaper',
|
||||||
|
|
||||||
# The font size ('10pt', '11pt' or '12pt').
|
# The font size ('10pt', '11pt' or '12pt').
|
||||||
# 'pointsize': '10pt',
|
# 'pointsize': '10pt',
|
||||||
|
|
||||||
# Additional stuff for the LaTeX preamble.
|
# Additional stuff for the LaTeX preamble.
|
||||||
# 'preamble': '',
|
# 'preamble': '',
|
||||||
}
|
}
|
||||||
@@ -235,13 +233,15 @@ latex_elements = {
|
|||||||
# Grouping the document tree into LaTeX files. List of tuples
|
# Grouping the document tree into LaTeX files. List of tuples
|
||||||
# (source start file, target name, title,
|
# (source start file, target name, title,
|
||||||
# author, documentclass [howto, manual, or own class]).
|
# author, documentclass [howto, manual, or own class]).
|
||||||
latex_documents = [(
|
latex_documents = [
|
||||||
|
(
|
||||||
'index',
|
'index',
|
||||||
'OpenStackClientReleaseNotes.tex',
|
'OpenStackClientReleaseNotes.tex',
|
||||||
'OpenStackClient Release Notes Documentation',
|
'OpenStackClient Release Notes Documentation',
|
||||||
'OpenStackClient Developers',
|
'OpenStackClient Developers',
|
||||||
'manual',
|
'manual',
|
||||||
)]
|
)
|
||||||
|
]
|
||||||
|
|
||||||
# The name of an image file (relative to this directory) to place at the top of
|
# The name of an image file (relative to this directory) to place at the top of
|
||||||
# the title page.
|
# the title page.
|
||||||
@@ -268,13 +268,15 @@ latex_documents = [(
|
|||||||
|
|
||||||
# One entry per manual page. List of tuples
|
# One entry per manual page. List of tuples
|
||||||
# (source start file, name, description, authors, manual section).
|
# (source start file, name, description, authors, manual section).
|
||||||
man_pages = [(
|
man_pages = [
|
||||||
|
(
|
||||||
'index',
|
'index',
|
||||||
'openstackclientreleasenotes',
|
'openstackclientreleasenotes',
|
||||||
'OpenStackClient Release Notes Documentation',
|
'OpenStackClient Release Notes Documentation',
|
||||||
['OpenStackClient Developers'],
|
['OpenStackClient Developers'],
|
||||||
1,
|
1,
|
||||||
)]
|
)
|
||||||
|
]
|
||||||
|
|
||||||
# If true, show URL addresses after external links.
|
# If true, show URL addresses after external links.
|
||||||
# man_show_urls = False
|
# man_show_urls = False
|
||||||
@@ -285,7 +287,8 @@ man_pages = [(
|
|||||||
# Grouping the document tree into Texinfo files. List of tuples
|
# Grouping the document tree into Texinfo files. List of tuples
|
||||||
# (source start file, target name, title, author,
|
# (source start file, target name, title, author,
|
||||||
# dir menu entry, description, category)
|
# dir menu entry, description, category)
|
||||||
texinfo_documents = [(
|
texinfo_documents = [
|
||||||
|
(
|
||||||
'index',
|
'index',
|
||||||
'OpenStackClientReleaseNotes',
|
'OpenStackClientReleaseNotes',
|
||||||
'OpenStackclient Release Notes Documentation',
|
'OpenStackclient Release Notes Documentation',
|
||||||
@@ -293,7 +296,8 @@ texinfo_documents = [(
|
|||||||
'OpenStackClientReleaseNotes',
|
'OpenStackClientReleaseNotes',
|
||||||
'A unified command-line client for OpenStack.',
|
'A unified command-line client for OpenStack.',
|
||||||
'Miscellaneous',
|
'Miscellaneous',
|
||||||
)]
|
)
|
||||||
|
]
|
||||||
|
|
||||||
# Documents to append as an appendix to all manuals.
|
# Documents to append as an appendix to all manuals.
|
||||||
# texinfo_appendices = []
|
# texinfo_appendices = []
|
||||||
|
Reference in New Issue
Block a user