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:
parent
a6f81a736c
commit
d3f4a3d7f5
@ -15,18 +15,19 @@
|
||||
# -- General configuration ----------------------------------------------------
|
||||
|
||||
# If your documentation needs a minimal Sphinx version, state it here.
|
||||
#needs_sphinx = '1.0'
|
||||
# needs_sphinx = '1.0'
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
||||
extensions = ['sphinx.ext.autodoc',
|
||||
'sphinx.ext.doctest',
|
||||
'sphinx.ext.todo',
|
||||
'openstackdocstheme',
|
||||
'stevedore.sphinxext',
|
||||
'cliff.sphinxext',
|
||||
'sphinxcontrib.apidoc',
|
||||
]
|
||||
extensions = [
|
||||
'sphinx.ext.autodoc',
|
||||
'sphinx.ext.doctest',
|
||||
'sphinx.ext.todo',
|
||||
'openstackdocstheme',
|
||||
'stevedore.sphinxext',
|
||||
'cliff.sphinxext',
|
||||
'sphinxcontrib.apidoc',
|
||||
]
|
||||
|
||||
# openstackdocstheme options
|
||||
openstackdocs_repo_name = 'openstack/python-openstackclient'
|
||||
@ -39,13 +40,13 @@ openstackdocs_projects = [
|
||||
]
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
#templates_path = ['_templates']
|
||||
# templates_path = ['_templates']
|
||||
|
||||
# The suffix of source filenames.
|
||||
source_suffix = '.rst'
|
||||
|
||||
# The encoding of source files.
|
||||
#source_encoding = 'utf-8-sig'
|
||||
# source_encoding = 'utf-8-sig'
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
@ -56,13 +57,13 @@ copyright = '2012-2013 OpenStack Foundation'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
#language = None
|
||||
# language = None
|
||||
|
||||
# There are two options for replacing |today|: either, you set today to some
|
||||
# non-false value, then it is used:
|
||||
#today = ''
|
||||
# today = ''
|
||||
# Else, today_fmt is used as the format for a strftime call.
|
||||
#today_fmt = '%B %d, %Y'
|
||||
# today_fmt = '%B %d, %Y'
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
@ -70,18 +71,18 @@ exclude_patterns = ['**tests**']
|
||||
|
||||
# The reST default role (used for this markup: `text`) to use for all
|
||||
# documents.
|
||||
#default_role = None
|
||||
# default_role = None
|
||||
|
||||
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||
#add_function_parentheses = True
|
||||
# add_function_parentheses = True
|
||||
|
||||
# If true, the current module name will be prepended to all description
|
||||
# unit titles (such as .. function::).
|
||||
#add_module_names = True
|
||||
# add_module_names = True
|
||||
|
||||
# If true, sectionauthor and moduleauthor directives will be shown in the
|
||||
# output. They are ignored by default.
|
||||
#show_authors = False
|
||||
# show_authors = False
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'native'
|
||||
@ -94,75 +95,75 @@ modindex_common_prefix = ['openstackclient.']
|
||||
|
||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||
# a list of builtin themes.
|
||||
#html_theme_path = ["."]
|
||||
#html_theme = '_theme'
|
||||
# html_theme_path = ["."]
|
||||
# html_theme = '_theme'
|
||||
html_theme = 'openstackdocs'
|
||||
|
||||
# Theme options are theme-specific and customize the look and feel of a theme
|
||||
# further. For a list of options available for each theme, see the
|
||||
# documentation.
|
||||
#html_theme_options = {}
|
||||
# html_theme_options = {}
|
||||
|
||||
# Add any paths that contain custom themes here, relative to this directory.
|
||||
#html_theme_path = []
|
||||
# html_theme_path = []
|
||||
|
||||
# The name for this set of Sphinx documents. If None, it defaults to
|
||||
# "<project> v<release> documentation".
|
||||
#html_title = None
|
||||
# html_title = None
|
||||
|
||||
# A shorter title for the navigation bar. Default is the same as html_title.
|
||||
#html_short_title = None
|
||||
# html_short_title = None
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top
|
||||
# of the sidebar.
|
||||
#html_logo = None
|
||||
# html_logo = None
|
||||
|
||||
# The name of an image file (within the static path) to use as favicon of the
|
||||
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
||||
# pixels large.
|
||||
#html_favicon = None
|
||||
# html_favicon = None
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
#html_static_path = ['_static']
|
||||
# html_static_path = ['_static']
|
||||
|
||||
# If true, SmartyPants will be used to convert quotes and dashes to
|
||||
# typographically correct entities.
|
||||
#html_use_smartypants = True
|
||||
# html_use_smartypants = True
|
||||
|
||||
# Custom sidebar templates, maps document names to template names.
|
||||
#html_sidebars = {}
|
||||
# html_sidebars = {}
|
||||
|
||||
# Additional templates that should be rendered to pages, maps page names to
|
||||
# template names.
|
||||
#html_additional_pages = {}
|
||||
# html_additional_pages = {}
|
||||
|
||||
# If false, no module index is generated.
|
||||
#html_domain_indices = True
|
||||
# html_domain_indices = True
|
||||
|
||||
# If false, no index is generated.
|
||||
#html_use_index = True
|
||||
# html_use_index = True
|
||||
|
||||
# If true, the index is split into individual pages for each letter.
|
||||
#html_split_index = False
|
||||
# html_split_index = False
|
||||
|
||||
# If true, links to the reST sources are added to the pages.
|
||||
#html_show_sourcelink = True
|
||||
# html_show_sourcelink = True
|
||||
|
||||
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
|
||||
#html_show_sphinx = True
|
||||
# html_show_sphinx = True
|
||||
|
||||
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
|
||||
#html_show_copyright = True
|
||||
# html_show_copyright = True
|
||||
|
||||
# If true, an OpenSearch description file will be output, and all pages will
|
||||
# contain a <link> tag referring to it. The value of this option must be the
|
||||
# base URL from which the finished HTML is served.
|
||||
#html_use_opensearch = ''
|
||||
# html_use_opensearch = ''
|
||||
|
||||
# This is the file name suffix for HTML files (e.g. ".xhtml").
|
||||
#html_file_suffix = None
|
||||
# html_file_suffix = None
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'OpenStackCommandLineClientdoc'
|
||||
@ -174,44 +175,46 @@ html_extra_path = ['_extra']
|
||||
# -- Options for LaTeX output -------------------------------------------------
|
||||
|
||||
latex_elements = {
|
||||
# The paper size ('letterpaper' or 'a4paper').
|
||||
#'papersize': 'letterpaper',
|
||||
|
||||
# The font size ('10pt', '11pt' or '12pt').
|
||||
#'pointsize': '10pt',
|
||||
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
#'preamble': '',
|
||||
# The paper size ('letterpaper' or 'a4paper').
|
||||
#'papersize': 'letterpaper',
|
||||
# The font size ('10pt', '11pt' or '12pt').
|
||||
#'pointsize': '10pt',
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
#'preamble': '',
|
||||
}
|
||||
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title, author, documentclass [howto/manual])
|
||||
# .
|
||||
latex_documents = [
|
||||
('index', 'OpenStackCommandLineClient.tex',
|
||||
'OpenStack Command Line Client Documentation',
|
||||
'OpenStack', 'manual'),
|
||||
(
|
||||
'index',
|
||||
'OpenStackCommandLineClient.tex',
|
||||
'OpenStack Command Line Client Documentation',
|
||||
'OpenStack',
|
||||
'manual',
|
||||
),
|
||||
]
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
# the title page.
|
||||
#latex_logo = None
|
||||
# latex_logo = None
|
||||
|
||||
# For "manual" documents, if this is true, then toplevel headings are parts,
|
||||
# not chapters.
|
||||
#latex_use_parts = False
|
||||
# latex_use_parts = False
|
||||
|
||||
# If true, show page references after internal links.
|
||||
#latex_show_pagerefs = False
|
||||
# latex_show_pagerefs = False
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#latex_show_urls = False
|
||||
# latex_show_urls = False
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#latex_appendices = []
|
||||
# latex_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
#latex_domain_indices = True
|
||||
# latex_domain_indices = True
|
||||
|
||||
|
||||
# -- Options for manual page output -------------------------------------------
|
||||
@ -229,7 +232,7 @@ man_pages = [
|
||||
]
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#man_show_urls = False
|
||||
# man_show_urls = False
|
||||
|
||||
|
||||
# -- Options for Texinfo output -----------------------------------------------
|
||||
@ -238,21 +241,25 @@ man_pages = [
|
||||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
('index', 'OpenStackCommandLineClient',
|
||||
'OpenStack Command Line Client Documentation',
|
||||
'OpenStack', 'OpenStackCommandLineClient',
|
||||
'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
(
|
||||
'index',
|
||||
'OpenStackCommandLineClient',
|
||||
'OpenStack Command Line Client Documentation',
|
||||
'OpenStack',
|
||||
'OpenStackCommandLineClient',
|
||||
'One line description of project.',
|
||||
'Miscellaneous',
|
||||
),
|
||||
]
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#texinfo_appendices = []
|
||||
# texinfo_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
#texinfo_domain_indices = True
|
||||
# texinfo_domain_indices = True
|
||||
|
||||
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
||||
#texinfo_show_urls = 'footnote'
|
||||
# texinfo_show_urls = 'footnote'
|
||||
|
||||
|
||||
# -- Options for cliff.sphinxext plugin ---------------------------------------
|
||||
@ -260,8 +267,16 @@ texinfo_documents = [
|
||||
autoprogram_cliff_application = 'openstack'
|
||||
|
||||
autoprogram_cliff_ignored = [
|
||||
'--help', '--format', '--column', '--max-width', '--fit-width',
|
||||
'--print-empty', '--prefix', '--noindent', '--quote']
|
||||
'--help',
|
||||
'--format',
|
||||
'--column',
|
||||
'--max-width',
|
||||
'--fit-width',
|
||||
'--print-empty',
|
||||
'--prefix',
|
||||
'--noindent',
|
||||
'--quote',
|
||||
]
|
||||
|
||||
# Prevent cliff from generating "This command is provided by the
|
||||
# python-openstackclient plugin."
|
||||
|
@ -57,6 +57,7 @@ dump_stack_trace = False
|
||||
|
||||
# Generally useful stuff often found in a utils module
|
||||
|
||||
|
||||
def env(*vars, **kwargs):
|
||||
"""Search for the first defined of possibly many env vars
|
||||
|
||||
@ -73,6 +74,7 @@ def env(*vars, **kwargs):
|
||||
|
||||
# Common Example functions
|
||||
|
||||
|
||||
def base_parser(parser):
|
||||
"""Set up some of the common CLI options
|
||||
|
||||
@ -128,7 +130,8 @@ def base_parser(parser):
|
||||
help="Print API call timing info",
|
||||
)
|
||||
parser.add_argument(
|
||||
'-v', '--verbose',
|
||||
'-v',
|
||||
'--verbose',
|
||||
action='count',
|
||||
dest='verbose_level',
|
||||
default=1,
|
||||
@ -225,16 +228,14 @@ def make_session(opts, **kwargs):
|
||||
)
|
||||
auth_p = auth_plugin.load_from_options(**auth_params)
|
||||
|
||||
session = ks_session.Session(
|
||||
auth=auth_p,
|
||||
**kwargs
|
||||
)
|
||||
session = ks_session.Session(auth=auth_p, **kwargs)
|
||||
|
||||
return session
|
||||
|
||||
|
||||
# Top-level functions
|
||||
|
||||
|
||||
def run(opts):
|
||||
"""Default run command"""
|
||||
|
||||
|
@ -31,14 +31,13 @@ DEFAULT_DOMAIN = 'default'
|
||||
|
||||
|
||||
class OpenStackShell(shell.OpenStackShell):
|
||||
|
||||
def __init__(self):
|
||||
|
||||
super(OpenStackShell, self).__init__(
|
||||
description=__doc__.strip(),
|
||||
version=openstackclient.__version__,
|
||||
command_manager=commandmanager.CommandManager('openstack.cli'),
|
||||
deferred_help=True)
|
||||
deferred_help=True,
|
||||
)
|
||||
|
||||
self.api_version = {}
|
||||
|
||||
@ -51,8 +50,8 @@ class OpenStackShell(shell.OpenStackShell):
|
||||
|
||||
def build_option_parser(self, description, version):
|
||||
parser = super(OpenStackShell, self).build_option_parser(
|
||||
description,
|
||||
version)
|
||||
description, version
|
||||
)
|
||||
parser = clientmanager.build_plugin_option_parser(parser)
|
||||
parser = auth.build_auth_plugins_option_parser(parser)
|
||||
return parser
|
||||
@ -61,7 +60,7 @@ class OpenStackShell(shell.OpenStackShell):
|
||||
super(OpenStackShell, self)._final_defaults()
|
||||
|
||||
# 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
|
||||
self._auth_type = 'admin_token'
|
||||
else:
|
||||
@ -96,10 +95,12 @@ class OpenStackShell(shell.OpenStackShell):
|
||||
if version_opt not in mod_versions:
|
||||
sorted_versions = sorted(
|
||||
mod.API_VERSIONS.keys(),
|
||||
key=lambda s: list(map(int, s.split('.'))))
|
||||
key=lambda s: list(map(int, s.split('.'))),
|
||||
)
|
||||
self.log.warning(
|
||||
"%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
|
||||
version = '.v' + version_opt.replace('.', '_').split('_')[0]
|
||||
@ -107,7 +108,7 @@ class OpenStackShell(shell.OpenStackShell):
|
||||
self.command_manager.add_command_group(cmd_group)
|
||||
self.log.debug(
|
||||
'%(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):
|
||||
@ -116,8 +117,7 @@ class OpenStackShell(shell.OpenStackShell):
|
||||
osc-lib has no opinion on what commands should be loaded
|
||||
"""
|
||||
# Commands that span multiple APIs
|
||||
self.command_manager.add_command_group(
|
||||
'openstack.common')
|
||||
self.command_manager.add_command_group('openstack.common')
|
||||
|
||||
# This is the naive extension implementation referred to in
|
||||
# blueprint 'client-extensions'
|
||||
@ -129,8 +129,7 @@ class OpenStackShell(shell.OpenStackShell):
|
||||
# 'show_repo=qaz.github.repo:ShowRepo',
|
||||
# ],
|
||||
# }
|
||||
self.command_manager.add_command_group(
|
||||
'openstack.extension')
|
||||
self.command_manager.add_command_group('openstack.extension')
|
||||
|
||||
def initialize_app(self, 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:
|
||||
raise exceptions.CommandFailed(
|
||||
proc.returncode, cmd, result_out, result_err,
|
||||
proc.returncode,
|
||||
cmd,
|
||||
result_out,
|
||||
result_err,
|
||||
)
|
||||
|
||||
return result_out
|
||||
|
||||
|
||||
class TestCase(testtools.TestCase):
|
||||
|
||||
@classmethod
|
||||
def openstack(
|
||||
cls,
|
||||
@ -128,8 +130,9 @@ class TestCase(testtools.TestCase):
|
||||
|
||||
@classmethod
|
||||
def get_opts(cls, fields, output_format='value'):
|
||||
return ' -f {0} {1}'.format(output_format,
|
||||
' '.join(['-c ' + it for it in fields]))
|
||||
return ' -f {0} {1}'.format(
|
||||
output_format, ' '.join(['-c ' + it for it in fields])
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def assertOutput(cls, expected, actual):
|
||||
|
@ -29,8 +29,7 @@ REGION_NAME = "richie"
|
||||
INTERFACE = "catchy"
|
||||
VERSION = "3"
|
||||
|
||||
TEST_RESPONSE_DICT = fixture.V2Token(token_id=AUTH_TOKEN,
|
||||
user_name=USERNAME)
|
||||
TEST_RESPONSE_DICT = fixture.V2Token(token_id=AUTH_TOKEN, user_name=USERNAME)
|
||||
_s = TEST_RESPONSE_DICT.add_service('identity', name='keystone')
|
||||
_s.add_endpoint(AUTH_URL + ':5000/v2.0')
|
||||
_s = TEST_RESPONSE_DICT.add_service('network', name='neutron')
|
||||
@ -49,7 +48,6 @@ TEST_VERSIONS = fixture.DiscoveryList(href=AUTH_URL)
|
||||
|
||||
|
||||
class FakeStdout(object):
|
||||
|
||||
def __init__(self):
|
||||
self.content = []
|
||||
|
||||
@ -64,7 +62,6 @@ class FakeStdout(object):
|
||||
|
||||
|
||||
class FakeLog(object):
|
||||
|
||||
def __init__(self):
|
||||
self.messages = {}
|
||||
|
||||
@ -85,7 +82,6 @@ class FakeLog(object):
|
||||
|
||||
|
||||
class FakeApp(object):
|
||||
|
||||
def __init__(self, _stdout, _log):
|
||||
self.stdout = _stdout
|
||||
self.client_manager = None
|
||||
@ -102,7 +98,6 @@ class FakeOptions(object):
|
||||
|
||||
|
||||
class FakeClient(object):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
self.endpoint = kwargs['endpoint']
|
||||
self.token = kwargs['token']
|
||||
@ -131,7 +126,6 @@ class FakeClientManager(object):
|
||||
self.configuration_type = 'cloud_config'
|
||||
|
||||
def get_configuration(self):
|
||||
|
||||
config = {
|
||||
'region': REGION_NAME,
|
||||
'identity_api_version': VERSION,
|
||||
@ -161,7 +155,6 @@ class FakeClientManager(object):
|
||||
|
||||
|
||||
class FakeModule(object):
|
||||
|
||||
def __init__(self, name, version):
|
||||
self.name = name
|
||||
self.__version__ = version
|
||||
@ -171,7 +164,6 @@ class FakeModule(object):
|
||||
|
||||
|
||||
class FakeResource(object):
|
||||
|
||||
def __init__(self, manager=None, info=None, loaded=False, methods=None):
|
||||
"""Set attributes and methods for a resource.
|
||||
|
||||
@ -195,7 +187,7 @@ class FakeResource(object):
|
||||
self._loaded = loaded
|
||||
|
||||
def _add_details(self, info):
|
||||
for (k, v) in info.items():
|
||||
for k, v in info.items():
|
||||
setattr(self, k, v)
|
||||
|
||||
def _add_methods(self, methods):
|
||||
@ -206,13 +198,14 @@ class FakeResource(object):
|
||||
@value. When users access the attribute with (), @value will be
|
||||
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)
|
||||
setattr(self, name, method)
|
||||
|
||||
def __repr__(self):
|
||||
reprkeys = sorted(k for k in self.__dict__.keys() if k[0] != '_' and
|
||||
k != 'manager')
|
||||
reprkeys = sorted(
|
||||
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)
|
||||
return "<%s %s>" % (self.__class__.__name__, info)
|
||||
|
||||
@ -237,9 +230,9 @@ class FakeResource(object):
|
||||
|
||||
|
||||
class FakeResponse(requests.Response):
|
||||
|
||||
def __init__(self, headers=None, status_code=200,
|
||||
data=None, encoding=None):
|
||||
def __init__(
|
||||
self, headers=None, status_code=200, data=None, encoding=None
|
||||
):
|
||||
super(FakeResponse, self).__init__()
|
||||
|
||||
headers = headers or {}
|
||||
@ -253,7 +246,6 @@ class FakeResponse(requests.Response):
|
||||
|
||||
|
||||
class FakeModel(dict):
|
||||
|
||||
def __getattr__(self, key):
|
||||
try:
|
||||
return self[key]
|
||||
|
@ -51,15 +51,19 @@ V3_VERSION_RESP = {
|
||||
"version": {
|
||||
"status": "stable",
|
||||
"updated": "2016-04-04T00:00:00Z",
|
||||
"media-types": [{
|
||||
"base": "application/json",
|
||||
"type": "application/vnd.openstack.identity-v3+json",
|
||||
}],
|
||||
"media-types": [
|
||||
{
|
||||
"base": "application/json",
|
||||
"type": "application/vnd.openstack.identity-v3+json",
|
||||
}
|
||||
],
|
||||
"id": "v3.6",
|
||||
"links": [{
|
||||
"href": V3_AUTH_URL,
|
||||
"rel": "self",
|
||||
}]
|
||||
"links": [
|
||||
{
|
||||
"href": V3_AUTH_URL,
|
||||
"rel": "self",
|
||||
}
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
@ -114,7 +118,6 @@ def make_v3_token(req_mock):
|
||||
|
||||
|
||||
class TestInteg(utils.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestInteg, self).setUp()
|
||||
|
||||
|
@ -20,7 +20,6 @@ from openstackclient.tests.unit import test_shell
|
||||
|
||||
|
||||
class TestIntegV2ProjectID(test_base.TestInteg):
|
||||
|
||||
def setUp(self):
|
||||
super(TestIntegV2ProjectID, self).setUp()
|
||||
env = {
|
||||
@ -78,7 +77,6 @@ class TestIntegV2ProjectID(test_base.TestInteg):
|
||||
|
||||
|
||||
class TestIntegV2ProjectName(test_base.TestInteg):
|
||||
|
||||
def setUp(self):
|
||||
super(TestIntegV2ProjectName, self).setUp()
|
||||
env = {
|
||||
@ -136,7 +134,6 @@ class TestIntegV2ProjectName(test_base.TestInteg):
|
||||
|
||||
|
||||
class TestIntegV3ProjectID(test_base.TestInteg):
|
||||
|
||||
def setUp(self):
|
||||
super(TestIntegV3ProjectID, self).setUp()
|
||||
env = {
|
||||
@ -192,7 +189,6 @@ class TestIntegV3ProjectID(test_base.TestInteg):
|
||||
|
||||
|
||||
class TestIntegV3ProjectName(test_base.TestInteg):
|
||||
|
||||
def setUp(self):
|
||||
super(TestIntegV3ProjectName, self).setUp()
|
||||
env = {
|
||||
|
@ -22,7 +22,6 @@ from openstackclient.tests.unit import test_shell
|
||||
|
||||
|
||||
class TestIntegShellCliNoAuth(test_base.TestInteg):
|
||||
|
||||
def setUp(self):
|
||||
super(TestIntegShellCliNoAuth, self).setUp()
|
||||
env = {}
|
||||
@ -67,7 +66,6 @@ class TestIntegShellCliNoAuth(test_base.TestInteg):
|
||||
|
||||
|
||||
class TestIntegShellCliV2(test_base.TestInteg):
|
||||
|
||||
def setUp(self):
|
||||
super(TestIntegShellCliV2, self).setUp()
|
||||
env = {
|
||||
@ -155,7 +153,6 @@ class TestIntegShellCliV2(test_base.TestInteg):
|
||||
|
||||
|
||||
class TestIntegShellCliV2Ignore(test_base.TestInteg):
|
||||
|
||||
def setUp(self):
|
||||
super(TestIntegShellCliV2Ignore, self).setUp()
|
||||
env = {
|
||||
@ -202,7 +199,6 @@ class TestIntegShellCliV2Ignore(test_base.TestInteg):
|
||||
|
||||
|
||||
class TestIntegShellCliV3(test_base.TestInteg):
|
||||
|
||||
def setUp(self):
|
||||
super(TestIntegShellCliV3, self).setUp()
|
||||
env = {
|
||||
@ -293,7 +289,6 @@ class TestIntegShellCliV3(test_base.TestInteg):
|
||||
|
||||
|
||||
class TestIntegShellCliV3Prompt(test_base.TestInteg):
|
||||
|
||||
def setUp(self):
|
||||
super(TestIntegShellCliV3Prompt, self).setUp()
|
||||
env = {
|
||||
@ -318,8 +313,7 @@ class TestIntegShellCliV3Prompt(test_base.TestInteg):
|
||||
|
||||
# Check password callback set correctly
|
||||
self.assertEqual(
|
||||
mock_prompt,
|
||||
_shell.cloud._openstack_config._pw_callback
|
||||
mock_prompt, _shell.cloud._openstack_config._pw_callback
|
||||
)
|
||||
|
||||
# Check auth request
|
||||
@ -358,8 +352,9 @@ class TestIntegShellCliPrecedence(test_base.TestInteg):
|
||||
self.token = test_base.make_v3_token(self.requests_mock)
|
||||
|
||||
# Patch a v3 auth URL into the o-c-c data
|
||||
test_shell.PUBLIC_1['public-clouds']['megadodo']['auth']['auth_url'] \
|
||||
= test_base.V3_AUTH_URL
|
||||
test_shell.PUBLIC_1['public-clouds']['megadodo']['auth'][
|
||||
'auth_url'
|
||||
] = test_base.V3_AUTH_URL
|
||||
|
||||
def test_shell_args_options(self):
|
||||
"""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)
|
||||
|
||||
# Patch a v3 auth URL into the o-c-c data
|
||||
test_shell.PUBLIC_1['public-clouds']['megadodo']['auth']['auth_url'] \
|
||||
= test_base.V3_AUTH_URL
|
||||
test_shell.PUBLIC_1['public-clouds']['megadodo']['auth'][
|
||||
'auth_url'
|
||||
] = test_base.V3_AUTH_URL
|
||||
|
||||
def get_temp_file_path(self, filename):
|
||||
"""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')
|
||||
cloud2 = test_shell.get_cloud(log_file)
|
||||
return ('file.yaml', cloud2)
|
||||
|
||||
config_mock.side_effect = config_mock_return
|
||||
|
||||
def vendor_mock_return():
|
||||
return ('file.yaml', copy.deepcopy(test_shell.PUBLIC_1))
|
||||
|
||||
vendor_mock.side_effect = vendor_mock_return
|
||||
|
||||
_shell = shell.OpenStackShell()
|
||||
@ -528,10 +526,12 @@ class TestIntegShellCliPrecedenceOCC(test_base.TestInteg):
|
||||
log_file = self.get_temp_file_path('test_log_file')
|
||||
cloud2 = test_shell.get_cloud(log_file)
|
||||
return ('file.yaml', cloud2)
|
||||
|
||||
config_mock.side_effect = config_mock_return
|
||||
|
||||
def vendor_mock_return():
|
||||
return ('file.yaml', copy.deepcopy(test_shell.PUBLIC_1))
|
||||
|
||||
vendor_mock.side_effect = vendor_mock_return
|
||||
|
||||
_shell = shell.OpenStackShell()
|
||||
|
@ -96,7 +96,7 @@ global_options = {
|
||||
'--os-cacert': ('/dev/null', True, True),
|
||||
'--timing': (True, 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):
|
||||
|
||||
# Full name of the OpenStackShell class to test (cliff.app.App subclass)
|
||||
shell_class_name = "openstackclient.shell.OpenStackShell"
|
||||
|
||||
@ -179,8 +178,8 @@ class TestShell(osc_lib_test_utils.TestShell):
|
||||
|
||||
def _assert_token_auth(self, cmd_options, default_args):
|
||||
with mock.patch(
|
||||
self.app_patch + ".initialize_app",
|
||||
self.app,
|
||||
self.app_patch + ".initialize_app",
|
||||
self.app,
|
||||
):
|
||||
_shell = osc_lib_test_utils.make_shell(
|
||||
shell_class=self.shell_class,
|
||||
@ -191,20 +190,18 @@ class TestShell(osc_lib_test_utils.TestShell):
|
||||
|
||||
self.app.assert_called_with(["list", "role"])
|
||||
self.assertEqual(
|
||||
default_args.get("token", ''),
|
||||
_shell.options.token,
|
||||
"token"
|
||||
default_args.get("token", ''), _shell.options.token, "token"
|
||||
)
|
||||
self.assertEqual(
|
||||
default_args.get("auth_url", ''),
|
||||
_shell.options.auth_url,
|
||||
"auth_url"
|
||||
"auth_url",
|
||||
)
|
||||
|
||||
def _assert_cli(self, cmd_options, default_args):
|
||||
with mock.patch(
|
||||
self.shell_class_name + ".initialize_app",
|
||||
self.app,
|
||||
self.shell_class_name + ".initialize_app",
|
||||
self.app,
|
||||
):
|
||||
_shell = osc_lib_test_utils.make_shell(
|
||||
shell_class=self.shell_class,
|
||||
@ -213,20 +210,29 @@ class TestShell(osc_lib_test_utils.TestShell):
|
||||
osc_lib_test_utils.fake_execute(_shell, _cmd)
|
||||
|
||||
self.app.assert_called_with(["list", "server"])
|
||||
self.assertEqual(default_args["compute_api_version"],
|
||||
_shell.options.os_compute_api_version)
|
||||
self.assertEqual(default_args["identity_api_version"],
|
||||
_shell.options.os_identity_api_version)
|
||||
self.assertEqual(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)
|
||||
self.assertEqual(
|
||||
default_args["compute_api_version"],
|
||||
_shell.options.os_compute_api_version,
|
||||
)
|
||||
self.assertEqual(
|
||||
default_args["identity_api_version"],
|
||||
_shell.options.os_identity_api_version,
|
||||
)
|
||||
self.assertEqual(
|
||||
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):
|
||||
|
||||
def setUp(self):
|
||||
super(TestShellOptions, self).setUp()
|
||||
self.useFixture(osc_lib_test_utils.EnvFixture())
|
||||
@ -289,7 +295,6 @@ class TestShellOptions(TestShell):
|
||||
|
||||
|
||||
class TestShellTokenAuthEnv(TestShell):
|
||||
|
||||
def setUp(self):
|
||||
super(TestShellTokenAuthEnv, self).setUp()
|
||||
env = {
|
||||
@ -333,7 +338,6 @@ class TestShellTokenAuthEnv(TestShell):
|
||||
|
||||
|
||||
class TestShellTokenEndpointAuthEnv(TestShell):
|
||||
|
||||
def setUp(self):
|
||||
super(TestShellTokenEndpointAuthEnv, self).setUp()
|
||||
env = {
|
||||
@ -377,7 +381,6 @@ class TestShellTokenEndpointAuthEnv(TestShell):
|
||||
|
||||
|
||||
class TestShellCli(TestShell):
|
||||
|
||||
def setUp(self):
|
||||
super(TestShellCli, self).setUp()
|
||||
env = {
|
||||
@ -408,6 +411,6 @@ class TestShellCli(TestShell):
|
||||
"identity_api_version": LIB_IDENTITY_API_VERSION,
|
||||
"image_api_version": LIB_IMAGE_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)
|
||||
|
@ -29,22 +29,26 @@ class ParserException(Exception):
|
||||
|
||||
class CompareBySet(list):
|
||||
"""Class to compare value using set."""
|
||||
|
||||
def __eq__(self, other):
|
||||
return set(self) == set(other)
|
||||
|
||||
|
||||
class TestCase(testtools.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
testtools.TestCase.setUp(self)
|
||||
|
||||
if (os.environ.get("OS_STDOUT_CAPTURE") == "True" or
|
||||
os.environ.get("OS_STDOUT_CAPTURE") == "1"):
|
||||
if (
|
||||
os.environ.get("OS_STDOUT_CAPTURE") == "True"
|
||||
or os.environ.get("OS_STDOUT_CAPTURE") == "1"
|
||||
):
|
||||
stdout = self.useFixture(fixtures.StringStream("stdout")).stream
|
||||
self.useFixture(fixtures.MonkeyPatch("sys.stdout", stdout))
|
||||
|
||||
if (os.environ.get("OS_STDERR_CAPTURE") == "True" or
|
||||
os.environ.get("OS_STDERR_CAPTURE") == "1"):
|
||||
if (
|
||||
os.environ.get("OS_STDERR_CAPTURE") == "True"
|
||||
or os.environ.get("OS_STDERR_CAPTURE") == "1"
|
||||
):
|
||||
stderr = self.useFixture(fixtures.StringStream("stderr")).stream
|
||||
self.useFixture(fixtures.MonkeyPatch("sys.stderr", stderr))
|
||||
|
||||
@ -76,8 +80,9 @@ class TestCommand(TestCase):
|
||||
try:
|
||||
parsed_args = cmd_parser.parse_args(args)
|
||||
except SystemExit:
|
||||
raise ParserException("Argument parse failed: %s" %
|
||||
stderr.getvalue())
|
||||
raise ParserException(
|
||||
"Argument parse failed: %s" % stderr.getvalue()
|
||||
)
|
||||
for av in verify_args:
|
||||
attr, value = av
|
||||
if attr:
|
||||
|
@ -43,7 +43,7 @@ from sphinx.util import logging
|
||||
# https://github.com/sphinx-doc/sphinx/issues/10112 this may be applied as a
|
||||
# dirty hack until the issue with replacing extlinks is resolved
|
||||
linklogger = logging.getLogger('sphinx.ext.extlinks')
|
||||
linklogger.setLevel(40) # Ignore messages less severe than ERROR
|
||||
linklogger.setLevel(40) # Ignore messages less severe than ERROR
|
||||
|
||||
extensions = [
|
||||
'openstackdocstheme',
|
||||
@ -224,10 +224,8 @@ htmlhelp_basename = 'OpenStackClientReleaseNotesdoc'
|
||||
latex_elements = {
|
||||
# The paper size ('letterpaper' or 'a4paper').
|
||||
# 'papersize': 'letterpaper',
|
||||
|
||||
# The font size ('10pt', '11pt' or '12pt').
|
||||
# 'pointsize': '10pt',
|
||||
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
# 'preamble': '',
|
||||
}
|
||||
@ -235,13 +233,15 @@ latex_elements = {
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title,
|
||||
# author, documentclass [howto, manual, or own class]).
|
||||
latex_documents = [(
|
||||
'index',
|
||||
'OpenStackClientReleaseNotes.tex',
|
||||
'OpenStackClient Release Notes Documentation',
|
||||
'OpenStackClient Developers',
|
||||
'manual',
|
||||
)]
|
||||
latex_documents = [
|
||||
(
|
||||
'index',
|
||||
'OpenStackClientReleaseNotes.tex',
|
||||
'OpenStackClient Release Notes Documentation',
|
||||
'OpenStackClient Developers',
|
||||
'manual',
|
||||
)
|
||||
]
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
# the title page.
|
||||
@ -268,13 +268,15 @@ latex_documents = [(
|
||||
|
||||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [(
|
||||
'index',
|
||||
'openstackclientreleasenotes',
|
||||
'OpenStackClient Release Notes Documentation',
|
||||
['OpenStackClient Developers'],
|
||||
1,
|
||||
)]
|
||||
man_pages = [
|
||||
(
|
||||
'index',
|
||||
'openstackclientreleasenotes',
|
||||
'OpenStackClient Release Notes Documentation',
|
||||
['OpenStackClient Developers'],
|
||||
1,
|
||||
)
|
||||
]
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
# man_show_urls = False
|
||||
@ -285,15 +287,17 @@ man_pages = [(
|
||||
# Grouping the document tree into Texinfo files. List of tuples
|
||||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [(
|
||||
'index',
|
||||
'OpenStackClientReleaseNotes',
|
||||
'OpenStackclient Release Notes Documentation',
|
||||
'OpenStackclient Developers',
|
||||
'OpenStackClientReleaseNotes',
|
||||
'A unified command-line client for OpenStack.',
|
||||
'Miscellaneous',
|
||||
)]
|
||||
texinfo_documents = [
|
||||
(
|
||||
'index',
|
||||
'OpenStackClientReleaseNotes',
|
||||
'OpenStackclient Release Notes Documentation',
|
||||
'OpenStackclient Developers',
|
||||
'OpenStackClientReleaseNotes',
|
||||
'A unified command-line client for OpenStack.',
|
||||
'Miscellaneous',
|
||||
)
|
||||
]
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
# texinfo_appendices = []
|
||||
|
Loading…
x
Reference in New Issue
Block a user