Initial Split of python-keystoneclient to keystoneauth
Change-Id: Ib33d022506072749e23caf6d9defbcc9a65c8b48
This commit is contained in:
parent
0d0a57c963
commit
f70d313def
@ -1,7 +1,7 @@
|
|||||||
[run]
|
[run]
|
||||||
branch = True
|
branch = True
|
||||||
source = keystoneclient
|
source = keystoneauth
|
||||||
omit = keystoneclient/tests/*,keystoneclient/openstack/*
|
omit = keystoneauth/tests/*,keystoneauth/openstack/*
|
||||||
|
|
||||||
[report]
|
[report]
|
||||||
ignore-errors = True
|
ignore-errors = True
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[gerrit]
|
[gerrit]
|
||||||
host=review.openstack.org
|
host=review.openstack.org
|
||||||
port=29418
|
port=29418
|
||||||
project=openstack/python-keystoneclient.git
|
project=openstack/keystoneauth.git
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[DEFAULT]
|
[DEFAULT]
|
||||||
test_command=${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./keystoneclient/tests/unit} $LISTOPT $IDOPTION
|
test_command=${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./keystoneauth/tests/unit} $LISTOPT $IDOPTION
|
||||||
test_id_option=--load-list $IDFILE
|
test_id_option=--load-list $IDFILE
|
||||||
test_list_option=--list
|
test_list_option=--list
|
||||||
|
@ -15,4 +15,4 @@ Pull requests submitted through GitHub will be ignored.
|
|||||||
|
|
||||||
Bugs should be filed on Launchpad, not GitHub:
|
Bugs should be filed on Launchpad, not GitHub:
|
||||||
|
|
||||||
https://bugs.launchpad.net/python-keystoneclient
|
https://bugs.launchpad.net/keystoneauth
|
||||||
|
@ -15,7 +15,7 @@ exceptions to an instance or subclass of ClientException.
|
|||||||
Testing
|
Testing
|
||||||
=======
|
=======
|
||||||
|
|
||||||
python-keystoneclient uses testtools and testr for its unittest suite
|
keystoneauth uses testtools and testr for its unittest suite
|
||||||
and its test runner. Basic workflow around our use of tox and testr can
|
and its test runner. Basic workflow around our use of tox and testr can
|
||||||
be found at http://wiki.openstack.org/testr. If you'd like to learn more
|
be found at http://wiki.openstack.org/testr. If you'd like to learn more
|
||||||
in depth:
|
in depth:
|
||||||
|
2
LICENSE
2
LICENSE
@ -179,7 +179,7 @@ All rights reserved.
|
|||||||
incurred by, or claims asserted against, such Contributor by reason
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
of your accepting any such warranty or additional liability.
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
--- License for python-keystoneclient versions prior to 2.1 ---
|
--- License for keystoneauth versions prior to 2.1 ---
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@ import datetime
|
|||||||
|
|
||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
|
|
||||||
from keystoneclient.i18n import _
|
from keystoneauth.i18n import _
|
||||||
from keystoneclient import service_catalog
|
from keystoneauth import service_catalog
|
||||||
|
|
||||||
|
|
||||||
# gap, in seconds, to determine whether the given token is about to expire
|
# gap, in seconds, to determine whether the given token is about to expire
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
|
|
||||||
from keystoneclient import utils
|
from keystoneauth import utils
|
||||||
|
|
||||||
|
|
||||||
class Adapter(object):
|
class Adapter(object):
|
||||||
@ -25,7 +25,7 @@ class Adapter(object):
|
|||||||
of client local data around the global session object.
|
of client local data around the global session object.
|
||||||
|
|
||||||
:param session: The session object to wrap.
|
:param session: The session object to wrap.
|
||||||
:type session: keystoneclient.session.Session
|
:type session: keystonauth.session.Session
|
||||||
:param str service_type: The default service_type for URL discovery.
|
:param str service_type: The default service_type for URL discovery.
|
||||||
:param str service_name: The default service_name for URL discovery.
|
:param str service_name: The default service_name for URL discovery.
|
||||||
:param str interface: The default interface for URL discovery.
|
:param str interface: The default interface for URL discovery.
|
||||||
@ -34,7 +34,7 @@ class Adapter(object):
|
|||||||
for this client.
|
for this client.
|
||||||
:param tuple version: The version that this API targets.
|
:param tuple version: The version that this API targets.
|
||||||
:param auth: An auth plugin to use instead of the session one.
|
:param auth: An auth plugin to use instead of the session one.
|
||||||
:type auth: keystoneclient.auth.base.BaseAuthPlugin
|
:type auth: keystonauth.auth.base.BaseAuthPlugin
|
||||||
:param str user_agent: The User-Agent string to set.
|
:param str user_agent: The User-Agent string to set.
|
||||||
:param int connect_retries: the maximum number of retries that should
|
:param int connect_retries: the maximum number of retries that should
|
||||||
be attempted for connection errors.
|
be attempted for connection errors.
|
||||||
@ -99,9 +99,9 @@ class Adapter(object):
|
|||||||
|
|
||||||
:param auth: The auth plugin to use for token. Overrides the plugin
|
:param auth: The auth plugin to use for token. Overrides the plugin
|
||||||
on the session. (optional)
|
on the session. (optional)
|
||||||
:type auth: :class:`keystoneclient.auth.base.BaseAuthPlugin`
|
:type auth: :class:`keystonauth.auth.base.BaseAuthPlugin`
|
||||||
|
|
||||||
:raises keystoneclient.exceptions.AuthorizationFailure: if a new token
|
:raises keystonauth.exceptions.AuthorizationFailure: if a new token
|
||||||
fetch fails.
|
fetch fails.
|
||||||
|
|
||||||
:returns: A valid token.
|
:returns: A valid token.
|
||||||
@ -114,9 +114,9 @@ class Adapter(object):
|
|||||||
|
|
||||||
:param auth: The auth plugin to use for token. Overrides the plugin on
|
:param auth: The auth plugin to use for token. Overrides the plugin on
|
||||||
the session. (optional)
|
the session. (optional)
|
||||||
:type auth: :class:`keystoneclient.auth.base.BaseAuthPlugin`
|
:type auth: :class:`keystonauth.auth.base.BaseAuthPlugin`
|
||||||
|
|
||||||
:raises keystoneclient.exceptions.MissingAuthPlugin: if a plugin is not
|
:raises keystonauth.exceptions.MissingAuthPlugin: if a plugin is not
|
||||||
available.
|
available.
|
||||||
|
|
||||||
:returns: An endpoint if available or None.
|
:returns: An endpoint if available or None.
|
||||||
@ -137,11 +137,11 @@ class Adapter(object):
|
|||||||
|
|
||||||
:param auth: The auth plugin to use for token. Overrides the plugin
|
:param auth: The auth plugin to use for token. Overrides the plugin
|
||||||
on the session. (optional)
|
on the session. (optional)
|
||||||
:type auth: keystoneclient.auth.base.BaseAuthPlugin
|
:type auth: keystonauth.auth.base.BaseAuthPlugin
|
||||||
|
|
||||||
:raises keystoneclient.exceptions.AuthorizationFailure:
|
:raises keystonauth.exceptions.AuthorizationFailure:
|
||||||
if a new token fetch fails.
|
if a new token fetch fails.
|
||||||
:raises keystoneclient.exceptions.MissingAuthPlugin:
|
:raises keystonauth.exceptions.MissingAuthPlugin:
|
||||||
if a plugin is not available.
|
if a plugin is not available.
|
||||||
|
|
||||||
:returns: Current `user_id` or None if not supported by plugin.
|
:returns: Current `user_id` or None if not supported by plugin.
|
||||||
@ -154,11 +154,11 @@ class Adapter(object):
|
|||||||
|
|
||||||
:param auth: The auth plugin to use for token. Overrides the plugin
|
:param auth: The auth plugin to use for token. Overrides the plugin
|
||||||
on the session. (optional)
|
on the session. (optional)
|
||||||
:type auth: keystoneclient.auth.base.BaseAuthPlugin
|
:type auth: keystonauth.auth.base.BaseAuthPlugin
|
||||||
|
|
||||||
:raises keystoneclient.exceptions.AuthorizationFailure:
|
:raises keystonauth.exceptions.AuthorizationFailure:
|
||||||
if a new token fetch fails.
|
if a new token fetch fails.
|
||||||
:raises keystoneclient.exceptions.MissingAuthPlugin:
|
:raises keystonauth.exceptions.MissingAuthPlugin:
|
||||||
if a plugin is not available.
|
if a plugin is not available.
|
||||||
|
|
||||||
:returns: Current `project_id` or None if not supported by plugin.
|
:returns: Current `project_id` or None if not supported by plugin.
|
@ -11,9 +11,9 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
|
||||||
from keystoneclient.auth.base import * # noqa
|
from keystoneauth.auth.base import * # noqa
|
||||||
from keystoneclient.auth.cli import * # noqa
|
from keystoneauth.auth.cli import * # noqa
|
||||||
from keystoneclient.auth.conf import * # noqa
|
from keystoneauth.auth.conf import * # noqa
|
||||||
|
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
@ -15,7 +15,7 @@ import os
|
|||||||
import six
|
import six
|
||||||
import stevedore
|
import stevedore
|
||||||
|
|
||||||
from keystoneclient import exceptions
|
from keystoneauth import exceptions
|
||||||
|
|
||||||
|
|
||||||
# NOTE(jamielennox): The AUTH_INTERFACE is a special value that can be
|
# NOTE(jamielennox): The AUTH_INTERFACE is a special value that can be
|
||||||
@ -23,7 +23,7 @@ from keystoneclient import exceptions
|
|||||||
# 'interface' it should return the initial URL that was passed to the plugin.
|
# 'interface' it should return the initial URL that was passed to the plugin.
|
||||||
AUTH_INTERFACE = object()
|
AUTH_INTERFACE = object()
|
||||||
|
|
||||||
PLUGIN_NAMESPACE = 'keystoneclient.auth.plugin'
|
PLUGIN_NAMESPACE = 'keystonauth.auth.plugin'
|
||||||
IDENTITY_AUTH_HEADER_NAME = 'X-Auth-Token'
|
IDENTITY_AUTH_HEADER_NAME = 'X-Auth-Token'
|
||||||
|
|
||||||
|
|
||||||
@ -33,9 +33,9 @@ def get_plugin_class(name):
|
|||||||
:param str name: The name of the object to get.
|
:param str name: The name of the object to get.
|
||||||
|
|
||||||
:returns: An auth plugin class.
|
:returns: An auth plugin class.
|
||||||
:rtype: :py:class:`keystoneclient.auth.BaseAuthPlugin`
|
:rtype: :py:class:`keystonauth.auth.BaseAuthPlugin`
|
||||||
|
|
||||||
:raises keystoneclient.exceptions.NoMatchingPlugin: if a plugin cannot be
|
:raises keystonauth.exceptions.NoMatchingPlugin: if a plugin cannot be
|
||||||
created.
|
created.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
@ -73,7 +73,7 @@ class BaseAuthPlugin(object):
|
|||||||
the `get_headers` method instead.
|
the `get_headers` method instead.
|
||||||
|
|
||||||
:param session: A session object so the plugin can make HTTP calls.
|
:param session: A session object so the plugin can make HTTP calls.
|
||||||
:type session: keystoneclient.session.Session
|
:type session: keystonauth.session.Session
|
||||||
|
|
||||||
:return: A token to use.
|
:return: A token to use.
|
||||||
:rtype: string
|
:rtype: string
|
||||||
@ -104,7 +104,7 @@ class BaseAuthPlugin(object):
|
|||||||
achieved by returning an empty dictionary.
|
achieved by returning an empty dictionary.
|
||||||
|
|
||||||
:param session: The session object that the auth_plugin belongs to.
|
:param session: The session object that the auth_plugin belongs to.
|
||||||
:type session: keystoneclient.session.Session
|
:type session: keystonauth.session.Session
|
||||||
|
|
||||||
:returns: Headers that are set to authenticate a message or None for
|
:returns: Headers that are set to authenticate a message or None for
|
||||||
failure. Note that when checking this value that the empty
|
failure. Note that when checking this value that the empty
|
||||||
@ -132,7 +132,7 @@ class BaseAuthPlugin(object):
|
|||||||
- ``region_name``: the region the endpoint exists in.
|
- ``region_name``: the region the endpoint exists in.
|
||||||
|
|
||||||
:param session: The session object that the auth_plugin belongs to.
|
:param session: The session object that the auth_plugin belongs to.
|
||||||
:type session: keystoneclient.session.Session
|
:type session: keystonauth.session.Session
|
||||||
|
|
||||||
:returns: The base URL that will be used to talk to the required
|
:returns: The base URL that will be used to talk to the required
|
||||||
service or None if not available.
|
service or None if not available.
|
||||||
@ -164,7 +164,7 @@ class BaseAuthPlugin(object):
|
|||||||
currently authenticated user id.
|
currently authenticated user id.
|
||||||
|
|
||||||
:param session: A session object so the plugin can make HTTP calls.
|
:param session: A session object so the plugin can make HTTP calls.
|
||||||
:type session: keystoneclient.session.Session
|
:type session: keystonauth.session.Session
|
||||||
|
|
||||||
:returns: A user identifier or None if one is not available.
|
:returns: A user identifier or None if one is not available.
|
||||||
:rtype: str
|
:rtype: str
|
||||||
@ -179,7 +179,7 @@ class BaseAuthPlugin(object):
|
|||||||
the currently authenticated project id.
|
the currently authenticated project id.
|
||||||
|
|
||||||
:param session: A session object so the plugin can make HTTP calls.
|
:param session: A session object so the plugin can make HTTP calls.
|
||||||
:type session: keystoneclient.session.Session
|
:type session: keystonauth.session.Session
|
||||||
|
|
||||||
:returns: A project identifier or None if one is not available.
|
:returns: A project identifier or None if one is not available.
|
||||||
:rtype: str
|
:rtype: str
|
||||||
@ -253,7 +253,7 @@ class BaseAuthPlugin(object):
|
|||||||
:type namespace: argparse.Namespace
|
:type namespace: argparse.Namespace
|
||||||
|
|
||||||
:returns: An auth plugin, or None if a name is not provided.
|
:returns: An auth plugin, or None if a name is not provided.
|
||||||
:rtype: :py:class:`keystoneclient.auth.BaseAuthPlugin`
|
:rtype: :py:class:`keystonauth.auth.BaseAuthPlugin`
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def _getter(opt):
|
def _getter(opt):
|
||||||
@ -283,7 +283,7 @@ class BaseAuthPlugin(object):
|
|||||||
:param string group: The group name that options should be read from.
|
:param string group: The group name that options should be read from.
|
||||||
|
|
||||||
:returns: An authentication Plugin.
|
:returns: An authentication Plugin.
|
||||||
:rtype: :py:class:`keystoneclient.auth.BaseAuthPlugin`
|
:rtype: :py:class:`keystonauth.auth.BaseAuthPlugin`
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def _getter(opt):
|
def _getter(opt):
|
||||||
@ -306,7 +306,7 @@ class BaseAuthPlugin(object):
|
|||||||
:type getter: callable
|
:type getter: callable
|
||||||
|
|
||||||
:returns: An authentication Plugin.
|
:returns: An authentication Plugin.
|
||||||
:rtype: :py:class:`keystoneclient.auth.BaseAuthPlugin`
|
:rtype: :py:class:`keystonauth.auth.BaseAuthPlugin`
|
||||||
"""
|
"""
|
||||||
|
|
||||||
plugin_opts = cls.get_options()
|
plugin_opts = cls.get_options()
|
@ -13,8 +13,8 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from keystoneclient.auth import base
|
from keystoneauth.auth import base
|
||||||
from keystoneclient import utils
|
from keystoneauth import utils
|
||||||
|
|
||||||
|
|
||||||
@utils.positional()
|
@utils.positional()
|
||||||
@ -30,9 +30,9 @@ def register_argparse_arguments(parser, argv, default=None):
|
|||||||
if one isn't specified by the CLI. default: None.
|
if one isn't specified by the CLI. default: None.
|
||||||
|
|
||||||
:returns: The plugin class that will be loaded or None if not provided.
|
:returns: The plugin class that will be loaded or None if not provided.
|
||||||
:rtype: :py:class:`keystoneclient.auth.BaseAuthPlugin`
|
:rtype: :py:class:`keystonauth.auth.BaseAuthPlugin`
|
||||||
|
|
||||||
:raises keystoneclient.exceptions.NoMatchingPlugin: if a plugin cannot be
|
:raises keystonauth.exceptions.NoMatchingPlugin: if a plugin cannot be
|
||||||
created.
|
created.
|
||||||
"""
|
"""
|
||||||
in_parser = argparse.ArgumentParser(add_help=False)
|
in_parser = argparse.ArgumentParser(add_help=False)
|
||||||
@ -69,9 +69,9 @@ def load_from_argparse_arguments(namespace, **kwargs):
|
|||||||
:param Namespace namespace: The result from CLI parsing.
|
:param Namespace namespace: The result from CLI parsing.
|
||||||
|
|
||||||
:returns: An auth plugin, or None if a name is not provided.
|
:returns: An auth plugin, or None if a name is not provided.
|
||||||
:rtype: :py:class:`keystoneclient.auth.BaseAuthPlugin`
|
:rtype: :py:class:`keystonauth.auth.BaseAuthPlugin`
|
||||||
|
|
||||||
:raises keystoneclient.exceptions.NoMatchingPlugin: if a plugin cannot be
|
:raises keystonauth.exceptions.NoMatchingPlugin: if a plugin cannot be
|
||||||
created.
|
created.
|
||||||
"""
|
"""
|
||||||
if not namespace.os_auth_plugin:
|
if not namespace.os_auth_plugin:
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
|
|
||||||
from keystoneclient.auth import base
|
from keystoneauth.auth import base
|
||||||
|
|
||||||
_AUTH_PLUGIN_OPT = cfg.StrOpt('auth_plugin', help='Name of the plugin to load')
|
_AUTH_PLUGIN_OPT = cfg.StrOpt('auth_plugin', help='Name of the plugin to load')
|
||||||
|
|
||||||
@ -91,9 +91,9 @@ def load_from_conf_options(conf, group, **kwargs):
|
|||||||
:param string group: The group name that options should be read from.
|
:param string group: The group name that options should be read from.
|
||||||
|
|
||||||
:returns: An authentication Plugin or None if a name is not provided
|
:returns: An authentication Plugin or None if a name is not provided
|
||||||
:rtype: :py:class:`keystoneclient.auth.BaseAuthPlugin`
|
:rtype: :py:class:`keystonauth.auth.BaseAuthPlugin`
|
||||||
|
|
||||||
:raises keystoneclient.exceptions.NoMatchingPlugin: if a plugin cannot be
|
:raises keystonauth.exceptions.NoMatchingPlugin: if a plugin cannot be
|
||||||
created.
|
created.
|
||||||
"""
|
"""
|
||||||
# NOTE(jamielennox): plugins are allowed to specify a 'section' which is
|
# NOTE(jamielennox): plugins are allowed to specify a 'section' which is
|
@ -10,10 +10,10 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from keystoneclient.auth.identity import base
|
from keystoneauth.auth.identity import base
|
||||||
from keystoneclient.auth.identity import generic
|
from keystoneauth.auth.identity import generic
|
||||||
from keystoneclient.auth.identity import v2
|
from keystoneauth.auth.identity import v2
|
||||||
from keystoneclient.auth.identity import v3
|
from keystoneauth.auth.identity import v3
|
||||||
|
|
||||||
|
|
||||||
BaseIdentityPlugin = base.BaseIdentityPlugin
|
BaseIdentityPlugin = base.BaseIdentityPlugin
|
@ -10,8 +10,8 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from keystoneclient.auth.identity import base
|
from keystoneauth.auth.identity import base
|
||||||
from keystoneclient import utils
|
from keystoneauth import utils
|
||||||
|
|
||||||
|
|
||||||
class AccessInfoPlugin(base.BaseIdentityPlugin):
|
class AccessInfoPlugin(base.BaseIdentityPlugin):
|
||||||
@ -26,7 +26,7 @@ class AccessInfoPlugin(base.BaseIdentityPlugin):
|
|||||||
authorizing information.
|
authorizing information.
|
||||||
|
|
||||||
:param auth_ref: the existing AccessInfo object.
|
:param auth_ref: the existing AccessInfo object.
|
||||||
:type auth_ref: keystoneclient.access.AccessInfo
|
:type auth_ref: keystonauth.access.AccessInfo
|
||||||
:param auth_url: the url where this AccessInfo was retrieved from. Required
|
:param auth_url: the url where this AccessInfo was retrieved from. Required
|
||||||
if using the AUTH_INTERFACE with get_endpoint. (optional)
|
if using the AUTH_INTERFACE with get_endpoint. (optional)
|
||||||
"""
|
"""
|
@ -16,11 +16,11 @@ import logging
|
|||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from keystoneclient import _discover
|
from keystoneauth import _discover
|
||||||
from keystoneclient.auth import base
|
from keystoneauth.auth import base
|
||||||
from keystoneclient import exceptions
|
from keystoneauth import exceptions
|
||||||
from keystoneclient.i18n import _LW
|
from keystoneauth.i18n import _LW
|
||||||
from keystoneclient import utils
|
from keystoneauth import utils
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -76,16 +76,16 @@ class BaseIdentityPlugin(base.BaseAuthPlugin):
|
|||||||
data then you should use get_access.
|
data then you should use get_access.
|
||||||
|
|
||||||
:param session: A session object that can be used for communication.
|
:param session: A session object that can be used for communication.
|
||||||
:type session: keystoneclient.session.Session
|
:type session: keystonauth.session.Session
|
||||||
|
|
||||||
:raises keystoneclient.exceptions.InvalidResponse: The response
|
:raises keystonauth.exceptions.InvalidResponse: The response
|
||||||
returned wasn't
|
returned wasn't
|
||||||
appropriate.
|
appropriate.
|
||||||
:raises keystoneclient.exceptions.HttpError: An error from an invalid
|
:raises keystonauth.exceptions.HttpError: An error from an invalid
|
||||||
HTTP response.
|
HTTP response.
|
||||||
|
|
||||||
:returns: Token access information.
|
:returns: Token access information.
|
||||||
:rtype: :py:class:`keystoneclient.access.AccessInfo`
|
:rtype: :py:class:`keystonauth.access.AccessInfo`
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def get_token(self, session, **kwargs):
|
def get_token(self, session, **kwargs):
|
||||||
@ -94,9 +94,9 @@ class BaseIdentityPlugin(base.BaseAuthPlugin):
|
|||||||
If a valid token is not present then a new one will be fetched.
|
If a valid token is not present then a new one will be fetched.
|
||||||
|
|
||||||
:param session: A session object that can be used for communication.
|
:param session: A session object that can be used for communication.
|
||||||
:type session: keystoneclient.session.Session
|
:type session: keystonauth.session.Session
|
||||||
|
|
||||||
:raises keystoneclient.exceptions.HttpError: An error from an invalid
|
:raises keystonauth.exceptions.HttpError: An error from an invalid
|
||||||
HTTP response.
|
HTTP response.
|
||||||
|
|
||||||
:return: A valid token.
|
:return: A valid token.
|
||||||
@ -133,13 +133,13 @@ class BaseIdentityPlugin(base.BaseAuthPlugin):
|
|||||||
one will be fetched.
|
one will be fetched.
|
||||||
|
|
||||||
:param session: A session object that can be used for communication.
|
:param session: A session object that can be used for communication.
|
||||||
:type session: keystoneclient.session.Session
|
:type session: keystonauth.session.Session
|
||||||
|
|
||||||
:raises keystoneclient.exceptions.HttpError: An error from an invalid
|
:raises keystonauth.exceptions.HttpError: An error from an invalid
|
||||||
HTTP response.
|
HTTP response.
|
||||||
|
|
||||||
:returns: Valid AccessInfo
|
:returns: Valid AccessInfo
|
||||||
:rtype: :py:class:`keystoneclient.access.AccessInfo`
|
:rtype: :py:class:`keystonauth.access.AccessInfo`
|
||||||
"""
|
"""
|
||||||
if self._needs_reauthenticate():
|
if self._needs_reauthenticate():
|
||||||
self.auth_ref = self.get_auth_ref(session)
|
self.auth_ref = self.get_auth_ref(session)
|
||||||
@ -175,7 +175,7 @@ class BaseIdentityPlugin(base.BaseAuthPlugin):
|
|||||||
the session and kwargs.
|
the session and kwargs.
|
||||||
|
|
||||||
:param session: A session object that can be used for communication.
|
:param session: A session object that can be used for communication.
|
||||||
:type session: keystoneclient.session.Session
|
:type session: keystonauth.session.Session
|
||||||
:param string service_type: The type of service to lookup the endpoint
|
:param string service_type: The type of service to lookup the endpoint
|
||||||
for. This plugin will return None (failure)
|
for. This plugin will return None (failure)
|
||||||
if service_type is not provided.
|
if service_type is not provided.
|
||||||
@ -191,7 +191,7 @@ class BaseIdentityPlugin(base.BaseAuthPlugin):
|
|||||||
:param tuple version: The minimum version number required for this
|
:param tuple version: The minimum version number required for this
|
||||||
endpoint. (optional)
|
endpoint. (optional)
|
||||||
|
|
||||||
:raises keystoneclient.exceptions.HttpError: An error from an invalid
|
:raises keystonauth.exceptions.HttpError: An error from an invalid
|
||||||
HTTP response.
|
HTTP response.
|
||||||
|
|
||||||
:return: A valid endpoint URL or None if not available.
|
:return: A valid endpoint URL or None if not available.
|
||||||
@ -266,15 +266,15 @@ class BaseIdentityPlugin(base.BaseAuthPlugin):
|
|||||||
be needed by users.
|
be needed by users.
|
||||||
|
|
||||||
:param session: A session object to discover with.
|
:param session: A session object to discover with.
|
||||||
:type session: keystoneclient.session.Session
|
:type session: keystonauth.session.Session
|
||||||
:param str url: The url to lookup.
|
:param str url: The url to lookup.
|
||||||
:param bool authenticated: Include a token in the discovery call.
|
:param bool authenticated: Include a token in the discovery call.
|
||||||
(optional) Defaults to None (use a token
|
(optional) Defaults to None (use a token
|
||||||
if a plugin is installed).
|
if a plugin is installed).
|
||||||
|
|
||||||
:raises keystoneclient.exceptions.DiscoveryFailure: if for some reason
|
:raises keystonauth.exceptions.DiscoveryFailure: if for some reason
|
||||||
the lookup fails.
|
the lookup fails.
|
||||||
:raises keystoneclient.exceptions.HttpError: An error from an invalid
|
:raises keystonauth.exceptions.HttpError: An error from an invalid
|
||||||
HTTP response.
|
HTTP response.
|
||||||
|
|
||||||
:returns: A discovery object with the results of looking up that URL.
|
:returns: A discovery object with the results of looking up that URL.
|
@ -10,9 +10,9 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from keystoneclient.auth.identity.generic.base import BaseGenericPlugin # noqa
|
from keystoneauth.auth.identity.generic.base import BaseGenericPlugin # noqa
|
||||||
from keystoneclient.auth.identity.generic.password import Password # noqa
|
from keystoneauth.auth.identity.generic.password import Password # noqa
|
||||||
from keystoneclient.auth.identity.generic.token import Token # noqa
|
from keystoneauth.auth.identity.generic.token import Token # noqa
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['BaseGenericPlugin',
|
__all__ = ['BaseGenericPlugin',
|
@ -17,10 +17,10 @@ from oslo_config import cfg
|
|||||||
import six
|
import six
|
||||||
import six.moves.urllib.parse as urlparse
|
import six.moves.urllib.parse as urlparse
|
||||||
|
|
||||||
from keystoneclient import _discover
|
from keystoneauth import _discover
|
||||||
from keystoneclient.auth.identity import base
|
from keystoneauth.auth.identity import base
|
||||||
from keystoneclient import exceptions
|
from keystoneauth import exceptions
|
||||||
from keystoneclient.i18n import _, _LW
|
from keystoneauth.i18n import _, _LW
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
@ -82,7 +82,7 @@ class BaseGenericPlugin(base.BaseIdentityPlugin):
|
|||||||
call will be made with other available URLs.
|
call will be made with other available URLs.
|
||||||
|
|
||||||
:param session: A session object.
|
:param session: A session object.
|
||||||
:type session: keystoneclient.session.Session
|
:type session: keystonauth.session.Session
|
||||||
:param tuple version: A tuple of the API version at the URL.
|
:param tuple version: A tuple of the API version at the URL.
|
||||||
:param string url: The base URL for this version.
|
:param string url: The base URL for this version.
|
||||||
:param string raw_status: The status that was in the discovery field.
|
:param string raw_status: The status that was in the discovery field.
|
@ -14,11 +14,11 @@ import logging
|
|||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
|
|
||||||
from keystoneclient import _discover
|
from keystoneauth import _discover
|
||||||
from keystoneclient.auth.identity.generic import base
|
from keystoneauth.auth.identity.generic import base
|
||||||
from keystoneclient.auth.identity import v2
|
from keystoneauth.auth.identity import v2
|
||||||
from keystoneclient.auth.identity import v3
|
from keystoneauth.auth.identity import v3
|
||||||
from keystoneclient import utils
|
from keystoneauth import utils
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
@ -14,10 +14,10 @@ import logging
|
|||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
|
|
||||||
from keystoneclient import _discover
|
from keystoneauth import _discover
|
||||||
from keystoneclient.auth.identity.generic import base
|
from keystoneauth.auth.identity.generic import base
|
||||||
from keystoneclient.auth.identity import v2
|
from keystoneauth.auth.identity import v2
|
||||||
from keystoneclient.auth.identity import v3
|
from keystoneauth.auth.identity import v3
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
@ -16,10 +16,10 @@ import logging
|
|||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from keystoneclient import access
|
from keystoneauth import access
|
||||||
from keystoneclient.auth.identity import base
|
from keystoneauth.auth.identity import base
|
||||||
from keystoneclient import exceptions
|
from keystoneauth import exceptions
|
||||||
from keystoneclient import utils
|
from keystoneauth import utils
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
@ -10,10 +10,10 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from keystoneclient.auth.identity.v3.base import * # noqa
|
from keystoneauth.auth.identity.v3.base import * # noqa
|
||||||
from keystoneclient.auth.identity.v3.federated import * # noqa
|
from keystoneauth.auth.identity.v3.federated import * # noqa
|
||||||
from keystoneclient.auth.identity.v3.password import * # noqa
|
from keystoneauth.auth.identity.v3.password import * # noqa
|
||||||
from keystoneclient.auth.identity.v3.token import * # noqa
|
from keystoneauth.auth.identity.v3.token import * # noqa
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['Auth',
|
__all__ = ['Auth',
|
@ -16,11 +16,11 @@ import logging
|
|||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from keystoneclient import access
|
from keystoneauth import access
|
||||||
from keystoneclient.auth.identity import base
|
from keystoneauth.auth.identity import base
|
||||||
from keystoneclient import exceptions
|
from keystoneauth import exceptions
|
||||||
from keystoneclient.i18n import _
|
from keystoneauth.i18n import _
|
||||||
from keystoneclient import utils
|
from keystoneauth import utils
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ class AuthMethod(object):
|
|||||||
"""Return the authentication section of an auth plugin.
|
"""Return the authentication section of an auth plugin.
|
||||||
|
|
||||||
:param session: The communication session.
|
:param session: The communication session.
|
||||||
:type session: keystoneclient.session.Session
|
:type session: keystonauth.session.Session
|
||||||
:param Auth auth: The auth plugin calling the method.
|
:param Auth auth: The auth plugin calling the method.
|
||||||
:param dict headers: The headers that will be sent with the auth
|
:param dict headers: The headers that will be sent with the auth
|
||||||
request if a plugin needs to add to them.
|
request if a plugin needs to add to them.
|
@ -15,8 +15,8 @@ import abc
|
|||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from keystoneclient.auth.identity.v3 import base
|
from keystoneauth.auth.identity.v3 import base
|
||||||
from keystoneclient.auth.identity.v3 import token
|
from keystoneauth.auth.identity.v3 import token
|
||||||
|
|
||||||
__all__ = ['FederatedBaseAuth']
|
__all__ = ['FederatedBaseAuth']
|
||||||
|
|
||||||
@ -88,10 +88,10 @@ class FederatedBaseAuth(base.BaseAuth):
|
|||||||
is present then the token is rescoped to that target.
|
is present then the token is rescoped to that target.
|
||||||
|
|
||||||
:param session: a session object to send out HTTP requests.
|
:param session: a session object to send out HTTP requests.
|
||||||
:type session: keystoneclient.session.Session
|
:type session: keystonauth.session.Session
|
||||||
|
|
||||||
:returns: a token data representation
|
:returns: a token data representation
|
||||||
:rtype: :py:class:`keystoneclient.access.AccessInfo`
|
:rtype: :py:class:`keystonauth.access.AccessInfo`
|
||||||
|
|
||||||
"""
|
"""
|
||||||
auth_ref = self.get_unscoped_auth_ref(session)
|
auth_ref = self.get_unscoped_auth_ref(session)
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
|
|
||||||
from keystoneclient.auth.identity.v3 import base
|
from keystoneauth.auth.identity.v3 import base
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['PasswordMethod', 'Password']
|
__all__ = ['PasswordMethod', 'Password']
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
|
|
||||||
from keystoneclient.auth.identity.v3 import base
|
from keystoneauth.auth.identity.v3 import base
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['TokenMethod', 'Token']
|
__all__ = ['TokenMethod', 'Token']
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
|
|
||||||
from keystoneclient.auth import base
|
from keystoneauth.auth import base
|
||||||
|
|
||||||
|
|
||||||
class Token(base.BaseAuthPlugin):
|
class Token(base.BaseAuthPlugin):
|
@ -27,8 +27,8 @@ Exception definitions.
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from keystoneclient.i18n import _
|
from keystoneauth.i18n import _
|
||||||
from keystoneclient.openstack.common.apiclient.exceptions import * # noqa
|
from keystoneauth.openstack.common.apiclient.exceptions import * # noqa
|
||||||
|
|
||||||
# NOTE(akurilin): This alias should be left here to support backwards
|
# NOTE(akurilin): This alias should be left here to support backwards
|
||||||
# compatibility until we are sure that usage of these exceptions in
|
# compatibility until we are sure that usage of these exceptions in
|
||||||
@ -73,7 +73,7 @@ class VersionNotAvailable(DiscoveryFailure):
|
|||||||
|
|
||||||
|
|
||||||
class MethodNotImplemented(ClientException):
|
class MethodNotImplemented(ClientException):
|
||||||
"""Method not implemented by the keystoneclient API."""
|
"""Method not implemented by the keystonauth API."""
|
||||||
|
|
||||||
|
|
||||||
class MissingAuthPlugin(ClientException):
|
class MissingAuthPlugin(ClientException):
|
@ -16,16 +16,16 @@ in testing.
|
|||||||
|
|
||||||
They should be considered part of the public API because they may be relied
|
They should be considered part of the public API because they may be relied
|
||||||
upon to generate test tokens for other clients. However they should never be
|
upon to generate test tokens for other clients. However they should never be
|
||||||
imported into the main client (keystoneclient or other). Because of this there
|
imported into the main client (keystonauth or other). Because of this there
|
||||||
may be dependencies from this module on libraries that are only available in
|
may be dependencies from this module on libraries that are only available in
|
||||||
testing.
|
testing.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from keystoneclient.fixture.discovery import * # noqa
|
from keystoneauth.fixture.discovery import * # noqa
|
||||||
from keystoneclient.fixture.exception import FixtureValidationError # noqa
|
from keystoneauth.fixture.exception import FixtureValidationError # noqa
|
||||||
from keystoneclient.fixture.v2 import Token as V2Token # noqa
|
from keystoneauth.fixture.v2 import Token as V2Token # noqa
|
||||||
from keystoneclient.fixture.v3 import Token as V3Token # noqa
|
from keystoneauth.fixture.v3 import Token as V3Token # noqa
|
||||||
from keystoneclient.fixture.v3 import V3FederationToken # noqa
|
from keystoneauth.fixture.v3 import V3FederationToken # noqa
|
||||||
|
|
||||||
__all__ = ['DiscoveryList',
|
__all__ = ['DiscoveryList',
|
||||||
'FixtureValidationError',
|
'FixtureValidationError',
|
@ -14,7 +14,7 @@ import datetime
|
|||||||
|
|
||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
|
|
||||||
from keystoneclient import utils
|
from keystoneauth import utils
|
||||||
|
|
||||||
__all__ = ['DiscoveryList',
|
__all__ = ['DiscoveryList',
|
||||||
'V2Discovery',
|
'V2Discovery',
|
@ -15,7 +15,7 @@ import uuid
|
|||||||
|
|
||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
|
|
||||||
from keystoneclient.fixture import exception
|
from keystoneauth.fixture import exception
|
||||||
|
|
||||||
|
|
||||||
class _Service(dict):
|
class _Service(dict):
|
@ -15,7 +15,7 @@ import uuid
|
|||||||
|
|
||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
|
|
||||||
from keystoneclient.fixture import exception
|
from keystoneauth.fixture import exception
|
||||||
|
|
||||||
|
|
||||||
class _Service(dict):
|
class _Service(dict):
|
@ -10,10 +10,10 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
"""python-keystoneclient's pep8 extensions.
|
"""keystoneauth's pep8 extensions.
|
||||||
|
|
||||||
In order to make the review process faster and easier for core devs we are
|
In order to make the review process faster and easier for core devs we are
|
||||||
adding some python-keystoneclient specific pep8 checks. This will catch common
|
adding some keystoneauth specific pep8 checks. This will catch common
|
||||||
errors so that core devs don't have to.
|
errors so that core devs don't have to.
|
||||||
|
|
||||||
"""
|
"""
|
@ -21,7 +21,7 @@ See http://docs.openstack.org/developer/oslo.i18n/usage.html .
|
|||||||
import oslo_i18n
|
import oslo_i18n
|
||||||
|
|
||||||
|
|
||||||
_translators = oslo_i18n.TranslatorFactory(domain='keystoneclient')
|
_translators = oslo_i18n.TranslatorFactory(domain='keystonauth')
|
||||||
|
|
||||||
# The primary translation function using the well-known name "_"
|
# The primary translation function using the well-known name "_"
|
||||||
_ = _translators.primary
|
_ = _translators.primary
|
@ -24,7 +24,7 @@ import oslo.i18n
|
|||||||
# repository. It is OK to have more than one translation function
|
# repository. It is OK to have more than one translation function
|
||||||
# using the same domain, since there will still only be one message
|
# using the same domain, since there will still only be one message
|
||||||
# catalog.
|
# catalog.
|
||||||
_translators = oslo.i18n.TranslatorFactory(domain='keystoneclient')
|
_translators = oslo.i18n.TranslatorFactory(domain='keystonauth')
|
||||||
|
|
||||||
# The primary translation function using the well-known name "_"
|
# The primary translation function using the well-known name "_"
|
||||||
_ = _translators.primary
|
_ = _translators.primary
|
0
keystoneauth/openstack/common/apiclient/__init__.py
Normal file
0
keystoneauth/openstack/common/apiclient/__init__.py
Normal file
@ -24,7 +24,7 @@ import os
|
|||||||
import six
|
import six
|
||||||
from stevedore import extension
|
from stevedore import extension
|
||||||
|
|
||||||
from keystoneclient.openstack.common.apiclient import exceptions
|
from keystoneauth.openstack.common.apiclient import exceptions
|
||||||
|
|
||||||
|
|
||||||
_discovered_plugins = {}
|
_discovered_plugins = {}
|
||||||
@ -41,7 +41,7 @@ def discover_auth_systems():
|
|||||||
def add_plugin(ext):
|
def add_plugin(ext):
|
||||||
_discovered_plugins[ext.name] = ext.plugin
|
_discovered_plugins[ext.name] = ext.plugin
|
||||||
|
|
||||||
ep_namespace = "keystoneclient.openstack.common.apiclient.auth"
|
ep_namespace = "keystonauth.openstack.common.apiclient.auth"
|
||||||
mgr = extension.ExtensionManager(ep_namespace)
|
mgr = extension.ExtensionManager(ep_namespace)
|
||||||
mgr.map(add_plugin)
|
mgr.map(add_plugin)
|
||||||
|
|
@ -30,8 +30,8 @@ from oslo.utils import strutils
|
|||||||
import six
|
import six
|
||||||
from six.moves.urllib import parse
|
from six.moves.urllib import parse
|
||||||
|
|
||||||
from keystoneclient.openstack.common._i18n import _
|
from keystoneauth.openstack.common._i18n import _
|
||||||
from keystoneclient.openstack.common.apiclient import exceptions
|
from keystoneauth.openstack.common.apiclient import exceptions
|
||||||
|
|
||||||
|
|
||||||
def getid(obj):
|
def getid(obj):
|
@ -38,8 +38,8 @@ from oslo.utils import encodeutils
|
|||||||
from oslo.utils import importutils
|
from oslo.utils import importutils
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from keystoneclient.openstack.common._i18n import _
|
from keystoneauth.openstack.common._i18n import _
|
||||||
from keystoneclient.openstack.common.apiclient import exceptions
|
from keystoneauth.openstack.common.apiclient import exceptions
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
SENSITIVE_HEADERS = ('X-Auth-Token', 'X-Subject-Token',)
|
SENSITIVE_HEADERS = ('X-Auth-Token', 'X-Subject-Token',)
|
||||||
@ -64,7 +64,7 @@ class HTTPClient(object):
|
|||||||
into terminal and send the same request with curl.
|
into terminal and send the same request with curl.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
user_agent = "keystoneclient.openstack.common.apiclient"
|
user_agent = "keystonauth.openstack.common.apiclient"
|
||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
auth_plugin,
|
auth_plugin,
|
||||||
@ -291,7 +291,7 @@ class HTTPClient(object):
|
|||||||
Example:
|
Example:
|
||||||
|
|
||||||
>>> def test_clients():
|
>>> def test_clients():
|
||||||
... from keystoneclient.auth import keystone
|
... from keystonauth.auth import keystone
|
||||||
... from openstack.common.apiclient import client
|
... from openstack.common.apiclient import client
|
||||||
... auth = keystone.KeystoneAuthPlugin(
|
... auth = keystone.KeystoneAuthPlugin(
|
||||||
... username="user", password="pass", tenant_name="tenant",
|
... username="user", password="pass", tenant_name="tenant",
|
||||||
@ -301,7 +301,7 @@ class HTTPClient(object):
|
|||||||
... from novaclient.v1_1 import client
|
... from novaclient.v1_1 import client
|
||||||
... client.Client(openstack_client)
|
... client.Client(openstack_client)
|
||||||
... # create keystone client
|
... # create keystone client
|
||||||
... from keystoneclient.v2_0 import client
|
... from keystonauth.v2_0 import client
|
||||||
... client.Client(openstack_client)
|
... client.Client(openstack_client)
|
||||||
... # use them
|
... # use them
|
||||||
... openstack_client.identity.tenants.list()
|
... openstack_client.identity.tenants.list()
|
@ -25,7 +25,7 @@ import sys
|
|||||||
|
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from keystoneclient.openstack.common._i18n import _
|
from keystoneauth.openstack.common._i18n import _
|
||||||
|
|
||||||
|
|
||||||
class ClientException(Exception):
|
class ClientException(Exception):
|
@ -30,7 +30,7 @@ import requests
|
|||||||
import six
|
import six
|
||||||
from six.moves.urllib import parse
|
from six.moves.urllib import parse
|
||||||
|
|
||||||
from keystoneclient.openstack.common.apiclient import client
|
from keystoneauth.openstack.common.apiclient import client
|
||||||
|
|
||||||
|
|
||||||
def assert_has_keys(dct, required=None, optional=None):
|
def assert_has_keys(dct, required=None, optional=None):
|
@ -14,9 +14,9 @@
|
|||||||
from oslo.utils import encodeutils
|
from oslo.utils import encodeutils
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from keystoneclient.openstack.common._i18n import _
|
from keystoneauth.openstack.common._i18n import _
|
||||||
from keystoneclient.openstack.common.apiclient import exceptions
|
from keystoneauth.openstack.common.apiclient import exceptions
|
||||||
from keystoneclient.openstack.common import uuidutils
|
from keystoneauth.openstack.common import uuidutils
|
||||||
|
|
||||||
|
|
||||||
def find_resource(manager, name_or_id, **find_args):
|
def find_resource(manager, name_or_id, **find_args):
|
@ -20,9 +20,9 @@ import abc
|
|||||||
|
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from keystoneclient import exceptions
|
from keystoneauth import exceptions
|
||||||
from keystoneclient.i18n import _
|
from keystoneauth.i18n import _
|
||||||
from keystoneclient import utils
|
from keystoneauth import utils
|
||||||
|
|
||||||
|
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
@six.add_metaclass(abc.ABCMeta)
|
@ -25,13 +25,13 @@ import requests
|
|||||||
import six
|
import six
|
||||||
from six.moves import urllib
|
from six.moves import urllib
|
||||||
|
|
||||||
from keystoneclient import exceptions
|
from keystoneauth import exceptions
|
||||||
from keystoneclient.i18n import _, _LI, _LW
|
from keystoneauth.i18n import _, _LI, _LW
|
||||||
from keystoneclient import utils
|
from keystoneauth import utils
|
||||||
|
|
||||||
osprofiler_web = importutils.try_import("osprofiler.web")
|
osprofiler_web = importutils.try_import("osprofiler.web")
|
||||||
|
|
||||||
USER_AGENT = 'python-keystoneclient'
|
USER_AGENT = 'keystoneauth'
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ class Session(object):
|
|||||||
|
|
||||||
:param auth: An authentication plugin to authenticate the session with.
|
:param auth: An authentication plugin to authenticate the session with.
|
||||||
(optional, defaults to None)
|
(optional, defaults to None)
|
||||||
:type auth: :py:class:`keystoneclient.auth.base.BaseAuthPlugin`
|
:type auth: :py:class:`keystonauth.auth.base.BaseAuthPlugin`
|
||||||
:param requests.Session session: A requests session object that can be used
|
:param requests.Session session: A requests session object that can be used
|
||||||
for issuing requests. (optional)
|
for issuing requests. (optional)
|
||||||
:param string original_ip: The original IP of the requesting user which
|
:param string original_ip: The original IP of the requesting user which
|
||||||
@ -104,7 +104,7 @@ class Session(object):
|
|||||||
to 0)
|
to 0)
|
||||||
:param string user_agent: A User-Agent header string to use for the
|
:param string user_agent: A User-Agent header string to use for the
|
||||||
request. If not provided a default is used.
|
request. If not provided a default is used.
|
||||||
(optional, defaults to 'python-keystoneclient')
|
(optional, defaults to 'keystoneauth')
|
||||||
:param int/bool redirect: Controls the maximum number of redirections that
|
:param int/bool redirect: Controls the maximum number of redirections that
|
||||||
can be followed by a request. Either an integer
|
can be followed by a request. Either an integer
|
||||||
for a specific count or True/False for
|
for a specific count or True/False for
|
||||||
@ -275,7 +275,7 @@ class Session(object):
|
|||||||
:param auth: The auth plugin to use when authenticating this request.
|
:param auth: The auth plugin to use when authenticating this request.
|
||||||
This will override the plugin that is attached to the
|
This will override the plugin that is attached to the
|
||||||
session (if any). (optional)
|
session (if any). (optional)
|
||||||
:type auth: :py:class:`keystoneclient.auth.base.BaseAuthPlugin`
|
:type auth: :py:class:`keystonauth.auth.base.BaseAuthPlugin`
|
||||||
:param requests_auth: A requests library auth plugin that cannot be
|
:param requests_auth: A requests library auth plugin that cannot be
|
||||||
passed via kwarg because the `auth` kwarg
|
passed via kwarg because the `auth` kwarg
|
||||||
collides with our own auth plugins. (optional)
|
collides with our own auth plugins. (optional)
|
||||||
@ -289,7 +289,7 @@ class Session(object):
|
|||||||
:param bool log: If True then log the request and response data to the
|
:param bool log: If True then log the request and response data to the
|
||||||
debug log. (optional, default True)
|
debug log. (optional, default True)
|
||||||
:param logger: The logger object to use to log request and responses.
|
:param logger: The logger object to use to log request and responses.
|
||||||
If not provided the keystoneclient.session default
|
If not provided the keystonauth.session default
|
||||||
logger will be used.
|
logger will be used.
|
||||||
:type logger: logging.Logger
|
:type logger: logging.Logger
|
||||||
:param kwargs: any other parameter that can be passed to
|
:param kwargs: any other parameter that can be passed to
|
||||||
@ -298,7 +298,7 @@ class Session(object):
|
|||||||
'allow_redirects' is ignored as redirects are handled
|
'allow_redirects' is ignored as redirects are handled
|
||||||
by the session.
|
by the session.
|
||||||
|
|
||||||
:raises keystoneclient.exceptions.ClientException: For connection
|
:raises keystonauth.exceptions.ClientException: For connection
|
||||||
failure, or to indicate an error response code.
|
failure, or to indicate an error response code.
|
||||||
|
|
||||||
:returns: The response to the request.
|
:returns: The response to the request.
|
||||||
@ -523,7 +523,7 @@ class Session(object):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def construct(cls, kwargs):
|
def construct(cls, kwargs):
|
||||||
"""Handles constructing a session from the older
|
"""Handles constructing a session from the older
|
||||||
:py:class:`~keystoneclient.httpclient.HTTPClient` args as well as the
|
:py:class:`~keystonauth.httpclient.HTTPClient` args as well as the
|
||||||
new request-style arguments.
|
new request-style arguments.
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
@ -584,11 +584,11 @@ class Session(object):
|
|||||||
|
|
||||||
:param auth: The auth plugin to use for token. Overrides the plugin
|
:param auth: The auth plugin to use for token. Overrides the plugin
|
||||||
on the session. (optional)
|
on the session. (optional)
|
||||||
:type auth: :py:class:`keystoneclient.auth.base.BaseAuthPlugin`
|
:type auth: :py:class:`keystonauth.auth.base.BaseAuthPlugin`
|
||||||
|
|
||||||
:raises keystoneclient.exceptions.AuthorizationFailure: if a new token
|
:raises keystonauth.exceptions.AuthorizationFailure: if a new token
|
||||||
fetch fails.
|
fetch fails.
|
||||||
:raises keystoneclient.exceptions.MissingAuthPlugin: if a plugin is not
|
:raises keystonauth.exceptions.MissingAuthPlugin: if a plugin is not
|
||||||
available.
|
available.
|
||||||
|
|
||||||
:returns: Authentication headers or None for failure.
|
:returns: Authentication headers or None for failure.
|
||||||
@ -602,11 +602,11 @@ class Session(object):
|
|||||||
|
|
||||||
:param auth: The auth plugin to use for token. Overrides the plugin
|
:param auth: The auth plugin to use for token. Overrides the plugin
|
||||||
on the session. (optional)
|
on the session. (optional)
|
||||||
:type auth: :py:class:`keystoneclient.auth.base.BaseAuthPlugin`
|
:type auth: :py:class:`keystonauth.auth.base.BaseAuthPlugin`
|
||||||
|
|
||||||
:raises keystoneclient.exceptions.AuthorizationFailure: if a new token
|
:raises keystonauth.exceptions.AuthorizationFailure: if a new token
|
||||||
fetch fails.
|
fetch fails.
|
||||||
:raises keystoneclient.exceptions.MissingAuthPlugin: if a plugin is not
|
:raises keystonauth.exceptions.MissingAuthPlugin: if a plugin is not
|
||||||
available.
|
available.
|
||||||
|
|
||||||
*DEPRECATED*: This assumes that the only header that is used to
|
*DEPRECATED*: This assumes that the only header that is used to
|
||||||
@ -623,9 +623,9 @@ class Session(object):
|
|||||||
|
|
||||||
:param auth: The auth plugin to use for token. Overrides the plugin on
|
:param auth: The auth plugin to use for token. Overrides the plugin on
|
||||||
the session. (optional)
|
the session. (optional)
|
||||||
:type auth: :py:class:`keystoneclient.auth.base.BaseAuthPlugin`
|
:type auth: :py:class:`keystonauth.auth.base.BaseAuthPlugin`
|
||||||
|
|
||||||
:raises keystoneclient.exceptions.MissingAuthPlugin: if a plugin is not
|
:raises keystonauth.exceptions.MissingAuthPlugin: if a plugin is not
|
||||||
available.
|
available.
|
||||||
|
|
||||||
:returns: An endpoint if available or None.
|
:returns: An endpoint if available or None.
|
||||||
@ -639,7 +639,7 @@ class Session(object):
|
|||||||
|
|
||||||
:param auth: The auth plugin to invalidate. Overrides the plugin on the
|
:param auth: The auth plugin to invalidate. Overrides the plugin on the
|
||||||
session. (optional)
|
session. (optional)
|
||||||
:type auth: :py:class:`keystoneclient.auth.base.BaseAuthPlugin`
|
:type auth: :py:class:`keystonauth.auth.base.BaseAuthPlugin`
|
||||||
|
|
||||||
"""
|
"""
|
||||||
auth = self._auth_required(auth, 'validate')
|
auth = self._auth_required(auth, 'validate')
|
||||||
@ -650,11 +650,11 @@ class Session(object):
|
|||||||
|
|
||||||
:param auth: The auth plugin to use for token. Overrides the plugin
|
:param auth: The auth plugin to use for token. Overrides the plugin
|
||||||
on the session. (optional)
|
on the session. (optional)
|
||||||
:type auth: keystoneclient.auth.base.BaseAuthPlugin
|
:type auth: keystonauth.auth.base.BaseAuthPlugin
|
||||||
|
|
||||||
:raises keystoneclient.exceptions.AuthorizationFailure:
|
:raises keystonauth.exceptions.AuthorizationFailure:
|
||||||
if a new token fetch fails.
|
if a new token fetch fails.
|
||||||
:raises keystoneclient.exceptions.MissingAuthPlugin:
|
:raises keystonauth.exceptions.MissingAuthPlugin:
|
||||||
if a plugin is not available.
|
if a plugin is not available.
|
||||||
|
|
||||||
:returns string: Current user_id or None if not supported by plugin.
|
:returns string: Current user_id or None if not supported by plugin.
|
||||||
@ -667,11 +667,11 @@ class Session(object):
|
|||||||
|
|
||||||
:param auth: The auth plugin to use for token. Overrides the plugin
|
:param auth: The auth plugin to use for token. Overrides the plugin
|
||||||
on the session. (optional)
|
on the session. (optional)
|
||||||
:type auth: keystoneclient.auth.base.BaseAuthPlugin
|
:type auth: keystonauth.auth.base.BaseAuthPlugin
|
||||||
|
|
||||||
:raises keystoneclient.exceptions.AuthorizationFailure:
|
:raises keystonauth.exceptions.AuthorizationFailure:
|
||||||
if a new token fetch fails.
|
if a new token fetch fails.
|
||||||
:raises keystoneclient.exceptions.MissingAuthPlugin:
|
:raises keystonauth.exceptions.MissingAuthPlugin:
|
||||||
if a plugin is not available.
|
if a plugin is not available.
|
||||||
|
|
||||||
:returns string: Current project_id or None if not supported by plugin.
|
:returns string: Current project_id or None if not supported by plugin.
|
0
keystoneauth/tests/__init__.py
Normal file
0
keystoneauth/tests/__init__.py
Normal file
0
keystoneauth/tests/unit/__init__.py
Normal file
0
keystoneauth/tests/unit/__init__.py
Normal file
0
keystoneauth/tests/unit/auth/__init__.py
Normal file
0
keystoneauth/tests/unit/auth/__init__.py
Normal file
@ -12,12 +12,12 @@
|
|||||||
|
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from keystoneclient import access
|
from keystoneauth import access
|
||||||
from keystoneclient import auth
|
from keystoneauth import auth
|
||||||
from keystoneclient.auth.identity import access as access_plugin
|
from keystoneauth.auth.identity import access as access_plugin
|
||||||
from keystoneclient import fixture
|
from keystoneauth import fixture
|
||||||
from keystoneclient import session
|
from keystoneauth import session
|
||||||
from keystoneclient.tests.unit import utils
|
from keystoneauth.tests.unit import utils
|
||||||
|
|
||||||
|
|
||||||
class AccessInfoPluginTests(utils.TestCase):
|
class AccessInfoPluginTests(utils.TestCase):
|
@ -17,9 +17,9 @@ import fixtures
|
|||||||
import mock
|
import mock
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
|
|
||||||
from keystoneclient.auth import base
|
from keystoneauth.auth import base
|
||||||
from keystoneclient.auth import cli
|
from keystoneauth.auth import cli
|
||||||
from keystoneclient.tests.unit.auth import utils
|
from keystoneauth.tests.unit.auth import utils
|
||||||
|
|
||||||
|
|
||||||
class TesterPlugin(base.BaseAuthPlugin):
|
class TesterPlugin(base.BaseAuthPlugin):
|
@ -17,12 +17,12 @@ from oslo_config import cfg
|
|||||||
from oslo_config import fixture as config
|
from oslo_config import fixture as config
|
||||||
import stevedore
|
import stevedore
|
||||||
|
|
||||||
from keystoneclient.auth import base
|
from keystoneauth.auth import base
|
||||||
from keystoneclient.auth import conf
|
from keystoneauth.auth import conf
|
||||||
from keystoneclient.auth.identity import v2 as v2_auth
|
from keystoneauth.auth.identity import v2 as v2_auth
|
||||||
from keystoneclient.auth.identity import v3 as v3_auth
|
from keystoneauth.auth.identity import v3 as v3_auth
|
||||||
from keystoneclient import exceptions
|
from keystoneauth import exceptions
|
||||||
from keystoneclient.tests.unit.auth import utils
|
from keystoneauth.tests.unit.auth import utils
|
||||||
|
|
||||||
|
|
||||||
class ConfTests(utils.TestCase):
|
class ConfTests(utils.TestCase):
|
@ -17,12 +17,12 @@ import uuid
|
|||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from keystoneclient import access
|
from keystoneauth import access
|
||||||
from keystoneclient.auth import base
|
from keystoneauth.auth import base
|
||||||
from keystoneclient.auth import identity
|
from keystoneauth.auth import identity
|
||||||
from keystoneclient import fixture
|
from keystoneauth import fixture
|
||||||
from keystoneclient import session
|
from keystoneauth import session
|
||||||
from keystoneclient.tests.unit import utils
|
from keystoneauth.tests.unit import utils
|
||||||
|
|
||||||
|
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
@six.add_metaclass(abc.ABCMeta)
|
@ -13,10 +13,10 @@
|
|||||||
import copy
|
import copy
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from keystoneclient.auth.identity import v2
|
from keystoneauth.auth.identity import v2
|
||||||
from keystoneclient import exceptions
|
from keystoneauth import exceptions
|
||||||
from keystoneclient import session
|
from keystoneauth import session
|
||||||
from keystoneclient.tests.unit import utils
|
from keystoneauth.tests.unit import utils
|
||||||
|
|
||||||
|
|
||||||
class V2IdentityPlugin(utils.TestCase):
|
class V2IdentityPlugin(utils.TestCase):
|
@ -13,14 +13,14 @@
|
|||||||
import copy
|
import copy
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from keystoneclient import access
|
from keystoneauth import access
|
||||||
from keystoneclient.auth.identity import v3
|
from keystoneauth.auth.identity import v3
|
||||||
from keystoneclient.auth.identity.v3 import base as v3_base
|
from keystoneauth.auth.identity.v3 import base as v3_base
|
||||||
from keystoneclient import client
|
from keystoneauth import client
|
||||||
from keystoneclient import exceptions
|
from keystoneauth import exceptions
|
||||||
from keystoneclient import fixture
|
from keystoneauth import fixture
|
||||||
from keystoneclient import session
|
from keystoneauth import session
|
||||||
from keystoneclient.tests.unit import utils
|
from keystoneauth.tests.unit import utils
|
||||||
|
|
||||||
|
|
||||||
class V3IdentityPlugin(utils.TestCase):
|
class V3IdentityPlugin(utils.TestCase):
|
@ -13,11 +13,11 @@
|
|||||||
import copy
|
import copy
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from keystoneclient import access
|
from keystoneauth import access
|
||||||
from keystoneclient.auth.identity import v3
|
from keystoneauth.auth.identity import v3
|
||||||
from keystoneclient import fixture
|
from keystoneauth import fixture
|
||||||
from keystoneclient import session
|
from keystoneauth import session
|
||||||
from keystoneclient.tests.unit import utils
|
from keystoneauth.tests.unit import utils
|
||||||
|
|
||||||
|
|
||||||
class TesterFederationPlugin(v3.FederatedBaseAuth):
|
class TesterFederationPlugin(v3.FederatedBaseAuth):
|
@ -14,7 +14,7 @@ import uuid
|
|||||||
|
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from keystoneclient.tests.unit.auth import utils
|
from keystoneauth.tests.unit.auth import utils
|
||||||
|
|
||||||
|
|
||||||
class TestOtherLoading(utils.TestCase):
|
class TestOtherLoading(utils.TestCase):
|
@ -12,11 +12,11 @@
|
|||||||
|
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from keystoneclient.auth.identity.generic import password
|
from keystoneauth.auth.identity.generic import password
|
||||||
from keystoneclient.auth.identity import v2
|
from keystoneauth.auth.identity import v2
|
||||||
from keystoneclient.auth.identity import v3
|
from keystoneauth.auth.identity import v3
|
||||||
from keystoneclient.auth.identity.v3 import password as v3_password
|
from keystoneauth.auth.identity.v3 import password as v3_password
|
||||||
from keystoneclient.tests.unit.auth import utils
|
from keystoneauth.tests.unit.auth import utils
|
||||||
|
|
||||||
|
|
||||||
class PasswordTests(utils.GenericPluginTestCase):
|
class PasswordTests(utils.GenericPluginTestCase):
|
@ -12,11 +12,11 @@
|
|||||||
|
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from keystoneclient.auth.identity.generic import token
|
from keystoneauth.auth.identity.generic import token
|
||||||
from keystoneclient.auth.identity import v2
|
from keystoneauth.auth.identity import v2
|
||||||
from keystoneclient.auth.identity import v3
|
from keystoneauth.auth.identity import v3
|
||||||
from keystoneclient.auth.identity.v3 import token as v3_token
|
from keystoneauth.auth.identity.v3 import token as v3_token
|
||||||
from keystoneclient.tests.unit.auth import utils
|
from keystoneauth.tests.unit.auth import utils
|
||||||
|
|
||||||
|
|
||||||
class TokenTests(utils.GenericPluginTestCase):
|
class TokenTests(utils.GenericPluginTestCase):
|
@ -12,9 +12,9 @@
|
|||||||
|
|
||||||
from testtools import matchers
|
from testtools import matchers
|
||||||
|
|
||||||
from keystoneclient.auth import token_endpoint
|
from keystoneauth.auth import token_endpoint
|
||||||
from keystoneclient import session
|
from keystoneauth import session
|
||||||
from keystoneclient.tests.unit import utils
|
from keystoneauth.tests.unit import utils
|
||||||
|
|
||||||
|
|
||||||
class TokenEndpointTest(utils.TestCase):
|
class TokenEndpointTest(utils.TestCase):
|
@ -17,12 +17,12 @@ import mock
|
|||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from keystoneclient import access
|
from keystoneauth import access
|
||||||
from keystoneclient.auth import base
|
from keystoneauth.auth import base
|
||||||
from keystoneclient import exceptions
|
from keystoneauth import exceptions
|
||||||
from keystoneclient import fixture
|
from keystoneauth import fixture
|
||||||
from keystoneclient import session
|
from keystoneauth import session
|
||||||
from keystoneclient.tests.unit import utils
|
from keystoneauth.tests.unit import utils
|
||||||
|
|
||||||
|
|
||||||
class MockPlugin(base.BaseAuthPlugin):
|
class MockPlugin(base.BaseAuthPlugin):
|
74
keystoneauth/tests/unit/keystoneauth_fixtures.py
Normal file
74
keystoneauth/tests/unit/keystoneauth_fixtures.py
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
# 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 fixtures
|
||||||
|
|
||||||
|
|
||||||
|
class HackingCode(fixtures.Fixture):
|
||||||
|
"""A fixture to house the various code examples for the keystoneclient
|
||||||
|
hacking style checks.
|
||||||
|
"""
|
||||||
|
|
||||||
|
oslo_namespace_imports = {
|
||||||
|
'code': """
|
||||||
|
import oslo.utils
|
||||||
|
import oslo_utils
|
||||||
|
import oslo.utils.encodeutils
|
||||||
|
import oslo_utils.encodeutils
|
||||||
|
from oslo import utils
|
||||||
|
from oslo.utils import encodeutils
|
||||||
|
from oslo_utils import encodeutils
|
||||||
|
|
||||||
|
import oslo.serialization
|
||||||
|
import oslo_serialization
|
||||||
|
import oslo.serialization.jsonutils
|
||||||
|
import oslo_serialization.jsonutils
|
||||||
|
from oslo import serialization
|
||||||
|
from oslo.serialization import jsonutils
|
||||||
|
from oslo_serialization import jsonutils
|
||||||
|
|
||||||
|
import oslo.config
|
||||||
|
import oslo_config
|
||||||
|
import oslo.config.cfg
|
||||||
|
import oslo_config.cfg
|
||||||
|
from oslo import config
|
||||||
|
from oslo.config import cfg
|
||||||
|
from oslo_config import cfg
|
||||||
|
|
||||||
|
import oslo.i18n
|
||||||
|
import oslo_i18n
|
||||||
|
import oslo.i18n.log
|
||||||
|
import oslo_i18n.log
|
||||||
|
from oslo import i18n
|
||||||
|
from oslo.i18n import log
|
||||||
|
from oslo_i18n import log
|
||||||
|
""",
|
||||||
|
'expected_errors': [
|
||||||
|
(1, 0, 'K333'),
|
||||||
|
(3, 0, 'K333'),
|
||||||
|
(5, 0, 'K333'),
|
||||||
|
(6, 0, 'K333'),
|
||||||
|
(9, 0, 'K333'),
|
||||||
|
(11, 0, 'K333'),
|
||||||
|
(13, 0, 'K333'),
|
||||||
|
(14, 0, 'K333'),
|
||||||
|
(17, 0, 'K333'),
|
||||||
|
(19, 0, 'K333'),
|
||||||
|
(21, 0, 'K333'),
|
||||||
|
(22, 0, 'K333'),
|
||||||
|
(25, 0, 'K333'),
|
||||||
|
(27, 0, 'K333'),
|
||||||
|
(29, 0, 'K333'),
|
||||||
|
(30, 0, 'K333'),
|
||||||
|
],
|
||||||
|
}
|
@ -17,16 +17,16 @@ from oslo_serialization import jsonutils
|
|||||||
import six
|
import six
|
||||||
from testtools import matchers
|
from testtools import matchers
|
||||||
|
|
||||||
from keystoneclient import _discover
|
from keystoneauth import _discover
|
||||||
from keystoneclient.auth import token_endpoint
|
from keystoneauth.auth import token_endpoint
|
||||||
from keystoneclient import client
|
from keystoneauth import client
|
||||||
from keystoneclient import discover
|
from keystoneauth import discover
|
||||||
from keystoneclient import exceptions
|
from keystoneauth import exceptions
|
||||||
from keystoneclient import fixture
|
from keystoneauth import fixture
|
||||||
from keystoneclient import session
|
from keystoneauth import session
|
||||||
from keystoneclient.tests.unit import utils
|
from keystoneauth.tests.unit import utils
|
||||||
from keystoneclient.v2_0 import client as v2_client
|
from keystoneauth.v2_0 import client as v2_client
|
||||||
from keystoneclient.v3 import client as v3_client
|
from keystoneauth.v3 import client as v3_client
|
||||||
|
|
||||||
|
|
||||||
BASE_HOST = 'http://keystone.example.com'
|
BASE_HOST = 'http://keystone.example.com'
|
@ -16,8 +16,8 @@ import mock
|
|||||||
import pep8
|
import pep8
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
from keystoneclient.hacking import checks
|
from keystoneauth.hacking import checks
|
||||||
from keystoneclient.tests.unit import client_fixtures
|
from keystoneauth.tests.unit import client_fixtures
|
||||||
|
|
||||||
|
|
||||||
class TestCheckOsloNamespaceImports(testtools.TestCase):
|
class TestCheckOsloNamespaceImports(testtools.TestCase):
|
@ -23,12 +23,12 @@ import requests
|
|||||||
import six
|
import six
|
||||||
from testtools import matchers
|
from testtools import matchers
|
||||||
|
|
||||||
from keystoneclient import adapter
|
from keystoneauth import adapter
|
||||||
from keystoneclient.auth import base
|
from keystoneauth.auth import base
|
||||||
from keystoneclient import exceptions
|
from keystoneauth import exceptions
|
||||||
from keystoneclient.i18n import _
|
from keystoneauth.i18n import _
|
||||||
from keystoneclient import session as client_session
|
from keystoneauth import session as client_session
|
||||||
from keystoneclient.tests.unit import utils
|
from keystoneauth.tests.unit import utils
|
||||||
|
|
||||||
|
|
||||||
class SessionTests(utils.TestCase):
|
class SessionTests(utils.TestCase):
|
209
keystoneauth/tests/unit/utils.py
Normal file
209
keystoneauth/tests/unit/utils.py
Normal file
@ -0,0 +1,209 @@
|
|||||||
|
# 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 logging
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
import fixtures
|
||||||
|
import mock
|
||||||
|
from mox3 import mox
|
||||||
|
from oslo_serialization import jsonutils
|
||||||
|
import requests
|
||||||
|
from requests_mock.contrib import fixture
|
||||||
|
import six
|
||||||
|
from six.moves.urllib import parse as urlparse
|
||||||
|
import testtools
|
||||||
|
|
||||||
|
|
||||||
|
class TestCase(testtools.TestCase):
|
||||||
|
|
||||||
|
TEST_DOMAIN_ID = '1'
|
||||||
|
TEST_DOMAIN_NAME = 'aDomain'
|
||||||
|
TEST_GROUP_ID = uuid.uuid4().hex
|
||||||
|
TEST_ROLE_ID = uuid.uuid4().hex
|
||||||
|
TEST_TENANT_ID = '1'
|
||||||
|
TEST_TENANT_NAME = 'aTenant'
|
||||||
|
TEST_TOKEN = 'aToken'
|
||||||
|
TEST_TRUST_ID = 'aTrust'
|
||||||
|
TEST_USER = 'test'
|
||||||
|
TEST_USER_ID = uuid.uuid4().hex
|
||||||
|
|
||||||
|
TEST_ROOT_URL = 'http://127.0.0.1:5000/'
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super(TestCase, self).setUp()
|
||||||
|
self.mox = mox.Mox()
|
||||||
|
self.logger = self.useFixture(fixtures.FakeLogger(level=logging.DEBUG))
|
||||||
|
self.time_patcher = mock.patch.object(time, 'time', lambda: 1234)
|
||||||
|
self.time_patcher.start()
|
||||||
|
|
||||||
|
self.requests_mock = self.useFixture(fixture.Fixture())
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
self.time_patcher.stop()
|
||||||
|
self.mox.UnsetStubs()
|
||||||
|
self.mox.VerifyAll()
|
||||||
|
super(TestCase, self).tearDown()
|
||||||
|
|
||||||
|
def stub_url(self, method, parts=None, base_url=None, json=None, **kwargs):
|
||||||
|
if not base_url:
|
||||||
|
base_url = self.TEST_URL
|
||||||
|
|
||||||
|
if json:
|
||||||
|
kwargs['text'] = jsonutils.dumps(json)
|
||||||
|
headers = kwargs.setdefault('headers', {})
|
||||||
|
headers['Content-Type'] = 'application/json'
|
||||||
|
|
||||||
|
if parts:
|
||||||
|
url = '/'.join([p.strip('/') for p in [base_url] + parts])
|
||||||
|
else:
|
||||||
|
url = base_url
|
||||||
|
|
||||||
|
url = url.replace("/?", "?")
|
||||||
|
self.requests_mock.register_uri(method, url, **kwargs)
|
||||||
|
|
||||||
|
def assertRequestBodyIs(self, body=None, json=None):
|
||||||
|
last_request_body = self.requests_mock.last_request.body
|
||||||
|
if json:
|
||||||
|
val = jsonutils.loads(last_request_body)
|
||||||
|
self.assertEqual(json, val)
|
||||||
|
elif body:
|
||||||
|
self.assertEqual(body, last_request_body)
|
||||||
|
|
||||||
|
def assertQueryStringIs(self, qs=''):
|
||||||
|
"""Verify the QueryString matches what is expected.
|
||||||
|
|
||||||
|
The qs parameter should be of the format \'foo=bar&abc=xyz\'
|
||||||
|
"""
|
||||||
|
expected = urlparse.parse_qs(qs, keep_blank_values=True)
|
||||||
|
parts = urlparse.urlparse(self.requests_mock.last_request.url)
|
||||||
|
querystring = urlparse.parse_qs(parts.query, keep_blank_values=True)
|
||||||
|
self.assertEqual(expected, querystring)
|
||||||
|
|
||||||
|
def assertQueryStringContains(self, **kwargs):
|
||||||
|
"""Verify the query string contains the expected parameters.
|
||||||
|
|
||||||
|
This method is used to verify that the query string for the most recent
|
||||||
|
request made contains all the parameters provided as ``kwargs``, and
|
||||||
|
that the value of each parameter contains the value for the kwarg. If
|
||||||
|
the value for the kwarg is an empty string (''), then all that's
|
||||||
|
verified is that the parameter is present.
|
||||||
|
|
||||||
|
"""
|
||||||
|
parts = urlparse.urlparse(self.requests_mock.last_request.url)
|
||||||
|
qs = urlparse.parse_qs(parts.query, keep_blank_values=True)
|
||||||
|
|
||||||
|
for k, v in six.iteritems(kwargs):
|
||||||
|
self.assertIn(k, qs)
|
||||||
|
self.assertIn(v, qs[k])
|
||||||
|
|
||||||
|
def assertRequestHeaderEqual(self, name, val):
|
||||||
|
"""Verify that the last request made contains a header and its value
|
||||||
|
|
||||||
|
The request must have already been made.
|
||||||
|
"""
|
||||||
|
headers = self.requests_mock.last_request.headers
|
||||||
|
self.assertEqual(headers.get(name), val)
|
||||||
|
|
||||||
|
|
||||||
|
if tuple(sys.version_info)[0:2] < (2, 7):
|
||||||
|
|
||||||
|
def assertDictEqual(self, d1, d2, msg=None):
|
||||||
|
# Simple version taken from 2.7
|
||||||
|
self.assertIsInstance(d1, dict,
|
||||||
|
'First argument is not a dictionary')
|
||||||
|
self.assertIsInstance(d2, dict,
|
||||||
|
'Second argument is not a dictionary')
|
||||||
|
if d1 != d2:
|
||||||
|
if msg:
|
||||||
|
self.fail(msg)
|
||||||
|
else:
|
||||||
|
standardMsg = '%r != %r' % (d1, d2)
|
||||||
|
self.fail(standardMsg)
|
||||||
|
|
||||||
|
TestCase.assertDictEqual = assertDictEqual
|
||||||
|
|
||||||
|
|
||||||
|
class TestResponse(requests.Response):
|
||||||
|
"""Class used to wrap requests.Response and provide some
|
||||||
|
convenience to initialize with a dict.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, data):
|
||||||
|
self._text = None
|
||||||
|
super(TestResponse, self).__init__()
|
||||||
|
if isinstance(data, dict):
|
||||||
|
self.status_code = data.get('status_code', 200)
|
||||||
|
headers = data.get('headers')
|
||||||
|
if headers:
|
||||||
|
self.headers.update(headers)
|
||||||
|
# Fake the text attribute to streamline Response creation
|
||||||
|
# _content is defined by requests.Response
|
||||||
|
self._content = data.get('text')
|
||||||
|
else:
|
||||||
|
self.status_code = data
|
||||||
|
|
||||||
|
def __eq__(self, other):
|
||||||
|
return self.__dict__ == other.__dict__
|
||||||
|
|
||||||
|
@property
|
||||||
|
def text(self):
|
||||||
|
return self.content
|
||||||
|
|
||||||
|
|
||||||
|
class DisableModuleFixture(fixtures.Fixture):
|
||||||
|
"""A fixture to provide support for unloading/disabling modules."""
|
||||||
|
|
||||||
|
def __init__(self, module, *args, **kw):
|
||||||
|
super(DisableModuleFixture, self).__init__(*args, **kw)
|
||||||
|
self.module = module
|
||||||
|
self._finders = []
|
||||||
|
self._cleared_modules = {}
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
super(DisableModuleFixture, self).tearDown()
|
||||||
|
for finder in self._finders:
|
||||||
|
sys.meta_path.remove(finder)
|
||||||
|
sys.modules.update(self._cleared_modules)
|
||||||
|
|
||||||
|
def clear_module(self):
|
||||||
|
cleared_modules = {}
|
||||||
|
for fullname in sys.modules.keys():
|
||||||
|
if (fullname == self.module or
|
||||||
|
fullname.startswith(self.module + '.')):
|
||||||
|
cleared_modules[fullname] = sys.modules.pop(fullname)
|
||||||
|
return cleared_modules
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
"""Ensure ImportError for the specified module."""
|
||||||
|
|
||||||
|
super(DisableModuleFixture, self).setUp()
|
||||||
|
|
||||||
|
# Clear 'module' references in sys.modules
|
||||||
|
self._cleared_modules.update(self.clear_module())
|
||||||
|
|
||||||
|
finder = NoModuleFinder(self.module)
|
||||||
|
self._finders.append(finder)
|
||||||
|
sys.meta_path.insert(0, finder)
|
||||||
|
|
||||||
|
|
||||||
|
class NoModuleFinder(object):
|
||||||
|
"""Disallow further imports of 'module'."""
|
||||||
|
|
||||||
|
def __init__(self, module):
|
||||||
|
self.module = module
|
||||||
|
|
||||||
|
def find_module(self, fullname, path):
|
||||||
|
if fullname == self.module or fullname.startswith(self.module + '.'):
|
||||||
|
raise ImportError
|
@ -21,7 +21,7 @@ from oslo_utils import encodeutils
|
|||||||
import prettytable
|
import prettytable
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from keystoneclient import exceptions
|
from keystoneauth import exceptions
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
@ -3,7 +3,6 @@
|
|||||||
# The list of modules to copy from oslo-incubator
|
# The list of modules to copy from oslo-incubator
|
||||||
module=apiclient
|
module=apiclient
|
||||||
module=install_venv_common
|
module=install_venv_common
|
||||||
module=memorycache
|
|
||||||
|
|
||||||
# The base module to hold the copy of openstack.common
|
# The base module to hold the copy of openstack.common
|
||||||
base=keystoneclient
|
base=keystoneauth
|
||||||
|
40
setup.cfg
40
setup.cfg
@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = python-keystoneclient
|
name = keystoneauth
|
||||||
summary = Client Library for OpenStack Identity
|
summary = Authentication Libarary for OpenStack Identity
|
||||||
description-file =
|
description-file =
|
||||||
README.rst
|
README.rst
|
||||||
author = OpenStack
|
author = OpenStack
|
||||||
@ -21,22 +21,20 @@ classifier =
|
|||||||
|
|
||||||
[files]
|
[files]
|
||||||
packages =
|
packages =
|
||||||
keystoneclient
|
keystoneauth
|
||||||
|
|
||||||
[entry_points]
|
[entry_points]
|
||||||
console_scripts =
|
|
||||||
keystone = keystoneclient.shell:main
|
|
||||||
|
|
||||||
keystoneclient.auth.plugin =
|
keystoneauth.auth.plugin =
|
||||||
password = keystoneclient.auth.identity.generic:Password
|
password = keystoneauth.auth.identity.generic:Password
|
||||||
token = keystoneclient.auth.identity.generic:Token
|
token = keystoneauth.auth.identity.generic:Token
|
||||||
v2password = keystoneclient.auth.identity.v2:Password
|
v2password = keystoneauth.auth.identity.v2:Password
|
||||||
v2token = keystoneclient.auth.identity.v2:Token
|
v2token = keystoneauth.auth.identity.v2:Token
|
||||||
v3password = keystoneclient.auth.identity.v3:Password
|
v3password = keystoneauth.auth.identity.v3:Password
|
||||||
v3token = keystoneclient.auth.identity.v3:Token
|
v3token = keystoneauth.auth.identity.v3:Token
|
||||||
v3unscopedsaml = keystoneclient.contrib.auth.v3.saml2:Saml2UnscopedToken
|
v3unscopedsaml = keystoneauth.contrib.auth.v3.saml2:Saml2UnscopedToken
|
||||||
v3scopedsaml = keystoneclient.contrib.auth.v3.saml2:Saml2ScopedToken
|
v3scopedsaml = keystoneauth.contrib.auth.v3.saml2:Saml2ScopedToken
|
||||||
v3unscopedadfs = keystoneclient.contrib.auth.v3.saml2:ADFSUnscopedToken
|
v3unscopedadfs = keystoneauth.contrib.auth.v3.saml2:ADFSUnscopedToken
|
||||||
|
|
||||||
[build_sphinx]
|
[build_sphinx]
|
||||||
source-dir = doc/source
|
source-dir = doc/source
|
||||||
@ -50,18 +48,18 @@ warnerrors = True
|
|||||||
upload-dir = doc/build/html
|
upload-dir = doc/build/html
|
||||||
|
|
||||||
[compile_catalog]
|
[compile_catalog]
|
||||||
directory = keystoneclient/locale
|
directory = keystoneauth/locale
|
||||||
domain = keystoneclient
|
domain = keystoneauth
|
||||||
|
|
||||||
[update_catalog]
|
[update_catalog]
|
||||||
domain = keystoneclient
|
domain = keystoneauth
|
||||||
output_dir = keystoneclient/locale
|
output_dir = keystoneauth/locale
|
||||||
input_file = keystoneclient/locale/keystoneclient.pot
|
input_file = keystoneauth/locale/keystoneauth.pot
|
||||||
|
|
||||||
[extract_messages]
|
[extract_messages]
|
||||||
keywords = _ gettext ngettext l_ lazy_gettext
|
keywords = _ gettext ngettext l_ lazy_gettext
|
||||||
mapping_file = babel.cfg
|
mapping_file = babel.cfg
|
||||||
output_file = keystoneclient/locale/keystoneclient.pot
|
output_file = keystoneauth/locale/keystoneauth.pot
|
||||||
|
|
||||||
[wheel]
|
[wheel]
|
||||||
universal = 1
|
universal = 1
|
||||||
|
8
tox.ini
8
tox.ini
@ -28,10 +28,10 @@ commands = python setup.py testr --coverage --testr-args='{posargs}'
|
|||||||
downloadcache = ~/cache/pip
|
downloadcache = ~/cache/pip
|
||||||
|
|
||||||
[testenv:debug]
|
[testenv:debug]
|
||||||
commands = oslo_debug_helper -t keystoneclient/tests {posargs}
|
commands = oslo_debug_helper -t keystoneauth/tests {posargs}
|
||||||
|
|
||||||
[testenv:functional]
|
[testenv:functional]
|
||||||
setenv = OS_TEST_PATH=./keystoneclient/tests/functional
|
setenv = OS_TEST_PATH=./keystoneauth/tests/functional
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
# H405: multi line docstring summary not separated with an empty line
|
# H405: multi line docstring summary not separated with an empty line
|
||||||
@ -45,5 +45,5 @@ commands=
|
|||||||
|
|
||||||
[hacking]
|
[hacking]
|
||||||
import_exceptions =
|
import_exceptions =
|
||||||
keystoneclient.i18n
|
keystoneauth.i18n
|
||||||
local-check-factory = keystoneclient.hacking.checks.factory
|
local-check-factory = keystoneauth.hacking.checks.factory
|
||||||
|
Loading…
Reference in New Issue
Block a user