Initial Split of python-keystoneclient to keystoneauth

Change-Id: Ib33d022506072749e23caf6d9defbcc9a65c8b48
This commit is contained in:
Morgan Fainberg 2015-04-20 14:22:07 -07:00
parent 0d0a57c963
commit f70d313def
75 changed files with 552 additions and 272 deletions

View File

@ -1,7 +1,7 @@
[run]
branch = True
source = keystoneclient
omit = keystoneclient/tests/*,keystoneclient/openstack/*
source = keystoneauth
omit = keystoneauth/tests/*,keystoneauth/openstack/*
[report]
ignore-errors = True

View File

@ -1,4 +1,4 @@
[gerrit]
host=review.openstack.org
port=29418
project=openstack/python-keystoneclient.git
project=openstack/keystoneauth.git

View File

@ -1,4 +1,4 @@
[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_list_option=--list

View File

@ -15,4 +15,4 @@ Pull requests submitted through GitHub will be ignored.
Bugs should be filed on Launchpad, not GitHub:
https://bugs.launchpad.net/python-keystoneclient
https://bugs.launchpad.net/keystoneauth

View File

@ -15,7 +15,7 @@ exceptions to an instance or subclass of ClientException.
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
be found at http://wiki.openstack.org/testr. If you'd like to learn more
in depth:

View File

@ -179,7 +179,7 @@ All rights reserved.
incurred by, or claims asserted against, such Contributor by reason
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.

View File

@ -19,8 +19,8 @@ import datetime
from oslo_utils import timeutils
from keystoneclient.i18n import _
from keystoneclient import service_catalog
from keystoneauth.i18n import _
from keystoneauth import service_catalog
# gap, in seconds, to determine whether the given token is about to expire

View File

@ -12,7 +12,7 @@
from oslo_serialization import jsonutils
from keystoneclient import utils
from keystoneauth import utils
class Adapter(object):
@ -25,7 +25,7 @@ class Adapter(object):
of client local data around the global session object.
: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_name: The default service_name for URL discovery.
:param str interface: The default interface for URL discovery.
@ -34,7 +34,7 @@ class Adapter(object):
for this client.
:param tuple version: The version that this API targets.
: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 int connect_retries: the maximum number of retries that should
be attempted for connection errors.
@ -99,9 +99,9 @@ class Adapter(object):
:param auth: The auth plugin to use for token. Overrides the plugin
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.
:returns: A valid token.
@ -114,9 +114,9 @@ class Adapter(object):
:param auth: The auth plugin to use for token. Overrides the plugin on
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.
: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
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.
:raises keystoneclient.exceptions.MissingAuthPlugin:
:raises keystonauth.exceptions.MissingAuthPlugin:
if a plugin is not available.
: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
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.
:raises keystoneclient.exceptions.MissingAuthPlugin:
:raises keystonauth.exceptions.MissingAuthPlugin:
if a plugin is not available.
:returns: Current `project_id` or None if not supported by plugin.

View File

@ -11,9 +11,9 @@
# under the License.
from keystoneclient.auth.base import * # noqa
from keystoneclient.auth.cli import * # noqa
from keystoneclient.auth.conf import * # noqa
from keystoneauth.auth.base import * # noqa
from keystoneauth.auth.cli import * # noqa
from keystoneauth.auth.conf import * # noqa
__all__ = [

View File

@ -15,7 +15,7 @@ import os
import six
import stevedore
from keystoneclient import exceptions
from keystoneauth import exceptions
# 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.
AUTH_INTERFACE = object()
PLUGIN_NAMESPACE = 'keystoneclient.auth.plugin'
PLUGIN_NAMESPACE = 'keystonauth.auth.plugin'
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.
: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.
"""
try:
@ -73,7 +73,7 @@ class BaseAuthPlugin(object):
the `get_headers` method instead.
: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.
:rtype: string
@ -104,7 +104,7 @@ class BaseAuthPlugin(object):
achieved by returning an empty dictionary.
: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
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.
: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
service or None if not available.
@ -164,7 +164,7 @@ class BaseAuthPlugin(object):
currently authenticated user id.
: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.
:rtype: str
@ -179,7 +179,7 @@ class BaseAuthPlugin(object):
the currently authenticated project id.
: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.
:rtype: str
@ -253,7 +253,7 @@ class BaseAuthPlugin(object):
:type namespace: argparse.Namespace
: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):
@ -283,7 +283,7 @@ class BaseAuthPlugin(object):
:param string group: The group name that options should be read from.
:returns: An authentication Plugin.
:rtype: :py:class:`keystoneclient.auth.BaseAuthPlugin`
:rtype: :py:class:`keystonauth.auth.BaseAuthPlugin`
"""
def _getter(opt):
@ -306,7 +306,7 @@ class BaseAuthPlugin(object):
:type getter: callable
:returns: An authentication Plugin.
:rtype: :py:class:`keystoneclient.auth.BaseAuthPlugin`
:rtype: :py:class:`keystonauth.auth.BaseAuthPlugin`
"""
plugin_opts = cls.get_options()

View File

@ -13,8 +13,8 @@
import argparse
import os
from keystoneclient.auth import base
from keystoneclient import utils
from keystoneauth.auth import base
from keystoneauth import utils
@utils.positional()
@ -30,9 +30,9 @@ def register_argparse_arguments(parser, argv, 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.
: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.
"""
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.
: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.
"""
if not namespace.os_auth_plugin:

View File

@ -12,7 +12,7 @@
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')
@ -91,9 +91,9 @@ def load_from_conf_options(conf, group, **kwargs):
:param string group: The group name that options should be read from.
: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.
"""
# NOTE(jamielennox): plugins are allowed to specify a 'section' which is

View File

@ -10,10 +10,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from keystoneclient.auth.identity import base
from keystoneclient.auth.identity import generic
from keystoneclient.auth.identity import v2
from keystoneclient.auth.identity import v3
from keystoneauth.auth.identity import base
from keystoneauth.auth.identity import generic
from keystoneauth.auth.identity import v2
from keystoneauth.auth.identity import v3
BaseIdentityPlugin = base.BaseIdentityPlugin

View File

@ -10,8 +10,8 @@
# License for the specific language governing permissions and limitations
# under the License.
from keystoneclient.auth.identity import base
from keystoneclient import utils
from keystoneauth.auth.identity import base
from keystoneauth import utils
class AccessInfoPlugin(base.BaseIdentityPlugin):
@ -26,7 +26,7 @@ class AccessInfoPlugin(base.BaseIdentityPlugin):
authorizing information.
: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
if using the AUTH_INTERFACE with get_endpoint. (optional)
"""

View File

@ -16,11 +16,11 @@ import logging
from oslo_config import cfg
import six
from keystoneclient import _discover
from keystoneclient.auth import base
from keystoneclient import exceptions
from keystoneclient.i18n import _LW
from keystoneclient import utils
from keystoneauth import _discover
from keystoneauth.auth import base
from keystoneauth import exceptions
from keystoneauth.i18n import _LW
from keystoneauth import utils
LOG = logging.getLogger(__name__)
@ -76,16 +76,16 @@ class BaseIdentityPlugin(base.BaseAuthPlugin):
data then you should use get_access.
: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
appropriate.
:raises keystoneclient.exceptions.HttpError: An error from an invalid
:raises keystonauth.exceptions.HttpError: An error from an invalid
HTTP response.
:returns: Token access information.
:rtype: :py:class:`keystoneclient.access.AccessInfo`
:rtype: :py:class:`keystonauth.access.AccessInfo`
"""
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.
: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.
:return: A valid token.
@ -133,13 +133,13 @@ class BaseIdentityPlugin(base.BaseAuthPlugin):
one will be fetched.
: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.
:returns: Valid AccessInfo
:rtype: :py:class:`keystoneclient.access.AccessInfo`
:rtype: :py:class:`keystonauth.access.AccessInfo`
"""
if self._needs_reauthenticate():
self.auth_ref = self.get_auth_ref(session)
@ -175,7 +175,7 @@ class BaseIdentityPlugin(base.BaseAuthPlugin):
the session and kwargs.
: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
for. This plugin will return None (failure)
if service_type is not provided.
@ -191,7 +191,7 @@ class BaseIdentityPlugin(base.BaseAuthPlugin):
:param tuple version: The minimum version number required for this
endpoint. (optional)
:raises keystoneclient.exceptions.HttpError: An error from an invalid
:raises keystonauth.exceptions.HttpError: An error from an invalid
HTTP response.
:return: A valid endpoint URL or None if not available.
@ -266,15 +266,15 @@ class BaseIdentityPlugin(base.BaseAuthPlugin):
be needed by users.
: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 bool authenticated: Include a token in the discovery call.
(optional) Defaults to None (use a token
if a plugin is installed).
:raises keystoneclient.exceptions.DiscoveryFailure: if for some reason
:raises keystonauth.exceptions.DiscoveryFailure: if for some reason
the lookup fails.
:raises keystoneclient.exceptions.HttpError: An error from an invalid
:raises keystonauth.exceptions.HttpError: An error from an invalid
HTTP response.
:returns: A discovery object with the results of looking up that URL.

View File

@ -10,9 +10,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from keystoneclient.auth.identity.generic.base import BaseGenericPlugin # noqa
from keystoneclient.auth.identity.generic.password import Password # noqa
from keystoneclient.auth.identity.generic.token import Token # noqa
from keystoneauth.auth.identity.generic.base import BaseGenericPlugin # noqa
from keystoneauth.auth.identity.generic.password import Password # noqa
from keystoneauth.auth.identity.generic.token import Token # noqa
__all__ = ['BaseGenericPlugin',

View File

@ -17,10 +17,10 @@ from oslo_config import cfg
import six
import six.moves.urllib.parse as urlparse
from keystoneclient import _discover
from keystoneclient.auth.identity import base
from keystoneclient import exceptions
from keystoneclient.i18n import _, _LW
from keystoneauth import _discover
from keystoneauth.auth.identity import base
from keystoneauth import exceptions
from keystoneauth.i18n import _, _LW
LOG = logging.getLogger(__name__)
@ -82,7 +82,7 @@ class BaseGenericPlugin(base.BaseIdentityPlugin):
call will be made with other available URLs.
: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 string url: The base URL for this version.
:param string raw_status: The status that was in the discovery field.

View File

@ -14,11 +14,11 @@ import logging
from oslo_config import cfg
from keystoneclient import _discover
from keystoneclient.auth.identity.generic import base
from keystoneclient.auth.identity import v2
from keystoneclient.auth.identity import v3
from keystoneclient import utils
from keystoneauth import _discover
from keystoneauth.auth.identity.generic import base
from keystoneauth.auth.identity import v2
from keystoneauth.auth.identity import v3
from keystoneauth import utils
LOG = logging.getLogger(__name__)

View File

@ -14,10 +14,10 @@ import logging
from oslo_config import cfg
from keystoneclient import _discover
from keystoneclient.auth.identity.generic import base
from keystoneclient.auth.identity import v2
from keystoneclient.auth.identity import v3
from keystoneauth import _discover
from keystoneauth.auth.identity.generic import base
from keystoneauth.auth.identity import v2
from keystoneauth.auth.identity import v3
LOG = logging.getLogger(__name__)

View File

@ -16,10 +16,10 @@ import logging
from oslo_config import cfg
import six
from keystoneclient import access
from keystoneclient.auth.identity import base
from keystoneclient import exceptions
from keystoneclient import utils
from keystoneauth import access
from keystoneauth.auth.identity import base
from keystoneauth import exceptions
from keystoneauth import utils
_logger = logging.getLogger(__name__)

View File

@ -10,10 +10,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from keystoneclient.auth.identity.v3.base import * # noqa
from keystoneclient.auth.identity.v3.federated import * # noqa
from keystoneclient.auth.identity.v3.password import * # noqa
from keystoneclient.auth.identity.v3.token import * # noqa
from keystoneauth.auth.identity.v3.base import * # noqa
from keystoneauth.auth.identity.v3.federated import * # noqa
from keystoneauth.auth.identity.v3.password import * # noqa
from keystoneauth.auth.identity.v3.token import * # noqa
__all__ = ['Auth',

View File

@ -16,11 +16,11 @@ import logging
from oslo_config import cfg
import six
from keystoneclient import access
from keystoneclient.auth.identity import base
from keystoneclient import exceptions
from keystoneclient.i18n import _
from keystoneclient import utils
from keystoneauth import access
from keystoneauth.auth.identity import base
from keystoneauth import exceptions
from keystoneauth.i18n import _
from keystoneauth import utils
_logger = logging.getLogger(__name__)
@ -222,7 +222,7 @@ class AuthMethod(object):
"""Return the authentication section of an auth plugin.
: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 dict headers: The headers that will be sent with the auth
request if a plugin needs to add to them.

View File

@ -15,8 +15,8 @@ import abc
from oslo_config import cfg
import six
from keystoneclient.auth.identity.v3 import base
from keystoneclient.auth.identity.v3 import token
from keystoneauth.auth.identity.v3 import base
from keystoneauth.auth.identity.v3 import token
__all__ = ['FederatedBaseAuth']
@ -88,10 +88,10 @@ class FederatedBaseAuth(base.BaseAuth):
is present then the token is rescoped to that target.
: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
:rtype: :py:class:`keystoneclient.access.AccessInfo`
:rtype: :py:class:`keystonauth.access.AccessInfo`
"""
auth_ref = self.get_unscoped_auth_ref(session)

View File

@ -12,7 +12,7 @@
from oslo_config import cfg
from keystoneclient.auth.identity.v3 import base
from keystoneauth.auth.identity.v3 import base
__all__ = ['PasswordMethod', 'Password']

View File

@ -12,7 +12,7 @@
from oslo_config import cfg
from keystoneclient.auth.identity.v3 import base
from keystoneauth.auth.identity.v3 import base
__all__ = ['TokenMethod', 'Token']

View File

@ -12,7 +12,7 @@
from oslo_config import cfg
from keystoneclient.auth import base
from keystoneauth.auth import base
class Token(base.BaseAuthPlugin):

View File

@ -27,8 +27,8 @@ Exception definitions.
"""
from keystoneclient.i18n import _
from keystoneclient.openstack.common.apiclient.exceptions import * # noqa
from keystoneauth.i18n import _
from keystoneauth.openstack.common.apiclient.exceptions import * # noqa
# NOTE(akurilin): This alias should be left here to support backwards
# compatibility until we are sure that usage of these exceptions in
@ -73,7 +73,7 @@ class VersionNotAvailable(DiscoveryFailure):
class MethodNotImplemented(ClientException):
"""Method not implemented by the keystoneclient API."""
"""Method not implemented by the keystonauth API."""
class MissingAuthPlugin(ClientException):

View File

@ -16,16 +16,16 @@ in testing.
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
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
testing.
"""
from keystoneclient.fixture.discovery import * # noqa
from keystoneclient.fixture.exception import FixtureValidationError # noqa
from keystoneclient.fixture.v2 import Token as V2Token # noqa
from keystoneclient.fixture.v3 import Token as V3Token # noqa
from keystoneclient.fixture.v3 import V3FederationToken # noqa
from keystoneauth.fixture.discovery import * # noqa
from keystoneauth.fixture.exception import FixtureValidationError # noqa
from keystoneauth.fixture.v2 import Token as V2Token # noqa
from keystoneauth.fixture.v3 import Token as V3Token # noqa
from keystoneauth.fixture.v3 import V3FederationToken # noqa
__all__ = ['DiscoveryList',
'FixtureValidationError',

View File

@ -14,7 +14,7 @@ import datetime
from oslo_utils import timeutils
from keystoneclient import utils
from keystoneauth import utils
__all__ = ['DiscoveryList',
'V2Discovery',

View File

@ -15,7 +15,7 @@ import uuid
from oslo_utils import timeutils
from keystoneclient.fixture import exception
from keystoneauth.fixture import exception
class _Service(dict):

View File

@ -15,7 +15,7 @@ import uuid
from oslo_utils import timeutils
from keystoneclient.fixture import exception
from keystoneauth.fixture import exception
class _Service(dict):

View File

@ -10,10 +10,10 @@
# License for the specific language governing permissions and limitations
# 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
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.
"""

View File

@ -21,7 +21,7 @@ See http://docs.openstack.org/developer/oslo.i18n/usage.html .
import oslo_i18n
_translators = oslo_i18n.TranslatorFactory(domain='keystoneclient')
_translators = oslo_i18n.TranslatorFactory(domain='keystonauth')
# The primary translation function using the well-known name "_"
_ = _translators.primary

View File

@ -24,7 +24,7 @@ import oslo.i18n
# repository. It is OK to have more than one translation function
# using the same domain, since there will still only be one message
# catalog.
_translators = oslo.i18n.TranslatorFactory(domain='keystoneclient')
_translators = oslo.i18n.TranslatorFactory(domain='keystonauth')
# The primary translation function using the well-known name "_"
_ = _translators.primary

View File

@ -24,7 +24,7 @@ import os
import six
from stevedore import extension
from keystoneclient.openstack.common.apiclient import exceptions
from keystoneauth.openstack.common.apiclient import exceptions
_discovered_plugins = {}
@ -41,7 +41,7 @@ def discover_auth_systems():
def add_plugin(ext):
_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.map(add_plugin)

View File

@ -30,8 +30,8 @@ from oslo.utils import strutils
import six
from six.moves.urllib import parse
from keystoneclient.openstack.common._i18n import _
from keystoneclient.openstack.common.apiclient import exceptions
from keystoneauth.openstack.common._i18n import _
from keystoneauth.openstack.common.apiclient import exceptions
def getid(obj):

View File

@ -38,8 +38,8 @@ from oslo.utils import encodeutils
from oslo.utils import importutils
import requests
from keystoneclient.openstack.common._i18n import _
from keystoneclient.openstack.common.apiclient import exceptions
from keystoneauth.openstack.common._i18n import _
from keystoneauth.openstack.common.apiclient import exceptions
_logger = logging.getLogger(__name__)
SENSITIVE_HEADERS = ('X-Auth-Token', 'X-Subject-Token',)
@ -64,7 +64,7 @@ class HTTPClient(object):
into terminal and send the same request with curl.
"""
user_agent = "keystoneclient.openstack.common.apiclient"
user_agent = "keystonauth.openstack.common.apiclient"
def __init__(self,
auth_plugin,
@ -291,7 +291,7 @@ class HTTPClient(object):
Example:
>>> def test_clients():
... from keystoneclient.auth import keystone
... from keystonauth.auth import keystone
... from openstack.common.apiclient import client
... auth = keystone.KeystoneAuthPlugin(
... username="user", password="pass", tenant_name="tenant",
@ -301,7 +301,7 @@ class HTTPClient(object):
... from novaclient.v1_1 import client
... client.Client(openstack_client)
... # create keystone client
... from keystoneclient.v2_0 import client
... from keystonauth.v2_0 import client
... client.Client(openstack_client)
... # use them
... openstack_client.identity.tenants.list()

View File

@ -25,7 +25,7 @@ import sys
import six
from keystoneclient.openstack.common._i18n import _
from keystoneauth.openstack.common._i18n import _
class ClientException(Exception):

View File

@ -30,7 +30,7 @@ import requests
import six
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):

View File

@ -14,9 +14,9 @@
from oslo.utils import encodeutils
import six
from keystoneclient.openstack.common._i18n import _
from keystoneclient.openstack.common.apiclient import exceptions
from keystoneclient.openstack.common import uuidutils
from keystoneauth.openstack.common._i18n import _
from keystoneauth.openstack.common.apiclient import exceptions
from keystoneauth.openstack.common import uuidutils
def find_resource(manager, name_or_id, **find_args):

View File

@ -20,9 +20,9 @@ import abc
import six
from keystoneclient import exceptions
from keystoneclient.i18n import _
from keystoneclient import utils
from keystoneauth import exceptions
from keystoneauth.i18n import _
from keystoneauth import utils
@six.add_metaclass(abc.ABCMeta)

View File

@ -25,13 +25,13 @@ import requests
import six
from six.moves import urllib
from keystoneclient import exceptions
from keystoneclient.i18n import _, _LI, _LW
from keystoneclient import utils
from keystoneauth import exceptions
from keystoneauth.i18n import _, _LI, _LW
from keystoneauth import utils
osprofiler_web = importutils.try_import("osprofiler.web")
USER_AGENT = 'python-keystoneclient'
USER_AGENT = 'keystoneauth'
_logger = logging.getLogger(__name__)
@ -82,7 +82,7 @@ class Session(object):
:param auth: An authentication plugin to authenticate the session with.
(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
for issuing requests. (optional)
:param string original_ip: The original IP of the requesting user which
@ -104,7 +104,7 @@ class Session(object):
to 0)
:param string user_agent: A User-Agent header string to use for the
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
can be followed by a request. Either an integer
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.
This will override the plugin that is attached to the
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
passed via kwarg because the `auth` kwarg
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
debug log. (optional, default True)
: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.
:type logger: logging.Logger
: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
by the session.
:raises keystoneclient.exceptions.ClientException: For connection
:raises keystonauth.exceptions.ClientException: For connection
failure, or to indicate an error response code.
:returns: The response to the request.
@ -523,7 +523,7 @@ class Session(object):
@classmethod
def construct(cls, kwargs):
"""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.
.. warning::
@ -584,11 +584,11 @@ class Session(object):
:param auth: The auth plugin to use for token. Overrides the plugin
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.
:raises keystoneclient.exceptions.MissingAuthPlugin: if a plugin is not
:raises keystonauth.exceptions.MissingAuthPlugin: if a plugin is not
available.
: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
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.
:raises keystoneclient.exceptions.MissingAuthPlugin: if a plugin is not
:raises keystonauth.exceptions.MissingAuthPlugin: if a plugin is not
available.
*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
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.
: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
session. (optional)
:type auth: :py:class:`keystoneclient.auth.base.BaseAuthPlugin`
:type auth: :py:class:`keystonauth.auth.base.BaseAuthPlugin`
"""
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
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.
:raises keystoneclient.exceptions.MissingAuthPlugin:
:raises keystonauth.exceptions.MissingAuthPlugin:
if a plugin is not available.
: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
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.
:raises keystoneclient.exceptions.MissingAuthPlugin:
:raises keystonauth.exceptions.MissingAuthPlugin:
if a plugin is not available.
:returns string: Current project_id or None if not supported by plugin.

View File

View File

View File

View File

@ -12,12 +12,12 @@
import uuid
from keystoneclient import access
from keystoneclient import auth
from keystoneclient.auth.identity import access as access_plugin
from keystoneclient import fixture
from keystoneclient import session
from keystoneclient.tests.unit import utils
from keystoneauth import access
from keystoneauth import auth
from keystoneauth.auth.identity import access as access_plugin
from keystoneauth import fixture
from keystoneauth import session
from keystoneauth.tests.unit import utils
class AccessInfoPluginTests(utils.TestCase):

View File

@ -17,9 +17,9 @@ import fixtures
import mock
from oslo_config import cfg
from keystoneclient.auth import base
from keystoneclient.auth import cli
from keystoneclient.tests.unit.auth import utils
from keystoneauth.auth import base
from keystoneauth.auth import cli
from keystoneauth.tests.unit.auth import utils
class TesterPlugin(base.BaseAuthPlugin):

View File

@ -17,12 +17,12 @@ from oslo_config import cfg
from oslo_config import fixture as config
import stevedore
from keystoneclient.auth import base
from keystoneclient.auth import conf
from keystoneclient.auth.identity import v2 as v2_auth
from keystoneclient.auth.identity import v3 as v3_auth
from keystoneclient import exceptions
from keystoneclient.tests.unit.auth import utils
from keystoneauth.auth import base
from keystoneauth.auth import conf
from keystoneauth.auth.identity import v2 as v2_auth
from keystoneauth.auth.identity import v3 as v3_auth
from keystoneauth import exceptions
from keystoneauth.tests.unit.auth import utils
class ConfTests(utils.TestCase):

View File

@ -17,12 +17,12 @@ import uuid
from oslo_utils import timeutils
import six
from keystoneclient import access
from keystoneclient.auth import base
from keystoneclient.auth import identity
from keystoneclient import fixture
from keystoneclient import session
from keystoneclient.tests.unit import utils
from keystoneauth import access
from keystoneauth.auth import base
from keystoneauth.auth import identity
from keystoneauth import fixture
from keystoneauth import session
from keystoneauth.tests.unit import utils
@six.add_metaclass(abc.ABCMeta)

View File

@ -13,10 +13,10 @@
import copy
import uuid
from keystoneclient.auth.identity import v2
from keystoneclient import exceptions
from keystoneclient import session
from keystoneclient.tests.unit import utils
from keystoneauth.auth.identity import v2
from keystoneauth import exceptions
from keystoneauth import session
from keystoneauth.tests.unit import utils
class V2IdentityPlugin(utils.TestCase):

View File

@ -13,14 +13,14 @@
import copy
import uuid
from keystoneclient import access
from keystoneclient.auth.identity import v3
from keystoneclient.auth.identity.v3 import base as v3_base
from keystoneclient import client
from keystoneclient import exceptions
from keystoneclient import fixture
from keystoneclient import session
from keystoneclient.tests.unit import utils
from keystoneauth import access
from keystoneauth.auth.identity import v3
from keystoneauth.auth.identity.v3 import base as v3_base
from keystoneauth import client
from keystoneauth import exceptions
from keystoneauth import fixture
from keystoneauth import session
from keystoneauth.tests.unit import utils
class V3IdentityPlugin(utils.TestCase):

View File

@ -13,11 +13,11 @@
import copy
import uuid
from keystoneclient import access
from keystoneclient.auth.identity import v3
from keystoneclient import fixture
from keystoneclient import session
from keystoneclient.tests.unit import utils
from keystoneauth import access
from keystoneauth.auth.identity import v3
from keystoneauth import fixture
from keystoneauth import session
from keystoneauth.tests.unit import utils
class TesterFederationPlugin(v3.FederatedBaseAuth):

View File

@ -14,7 +14,7 @@ import uuid
import six
from keystoneclient.tests.unit.auth import utils
from keystoneauth.tests.unit.auth import utils
class TestOtherLoading(utils.TestCase):

View File

@ -12,11 +12,11 @@
import uuid
from keystoneclient.auth.identity.generic import password
from keystoneclient.auth.identity import v2
from keystoneclient.auth.identity import v3
from keystoneclient.auth.identity.v3 import password as v3_password
from keystoneclient.tests.unit.auth import utils
from keystoneauth.auth.identity.generic import password
from keystoneauth.auth.identity import v2
from keystoneauth.auth.identity import v3
from keystoneauth.auth.identity.v3 import password as v3_password
from keystoneauth.tests.unit.auth import utils
class PasswordTests(utils.GenericPluginTestCase):

View File

@ -12,11 +12,11 @@
import uuid
from keystoneclient.auth.identity.generic import token
from keystoneclient.auth.identity import v2
from keystoneclient.auth.identity import v3
from keystoneclient.auth.identity.v3 import token as v3_token
from keystoneclient.tests.unit.auth import utils
from keystoneauth.auth.identity.generic import token
from keystoneauth.auth.identity import v2
from keystoneauth.auth.identity import v3
from keystoneauth.auth.identity.v3 import token as v3_token
from keystoneauth.tests.unit.auth import utils
class TokenTests(utils.GenericPluginTestCase):

View File

@ -12,9 +12,9 @@
from testtools import matchers
from keystoneclient.auth import token_endpoint
from keystoneclient import session
from keystoneclient.tests.unit import utils
from keystoneauth.auth import token_endpoint
from keystoneauth import session
from keystoneauth.tests.unit import utils
class TokenEndpointTest(utils.TestCase):

View File

@ -17,12 +17,12 @@ import mock
from oslo_config import cfg
import six
from keystoneclient import access
from keystoneclient.auth import base
from keystoneclient import exceptions
from keystoneclient import fixture
from keystoneclient import session
from keystoneclient.tests.unit import utils
from keystoneauth import access
from keystoneauth.auth import base
from keystoneauth import exceptions
from keystoneauth import fixture
from keystoneauth import session
from keystoneauth.tests.unit import utils
class MockPlugin(base.BaseAuthPlugin):

View 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'),
],
}

View File

@ -17,16 +17,16 @@ from oslo_serialization import jsonutils
import six
from testtools import matchers
from keystoneclient import _discover
from keystoneclient.auth import token_endpoint
from keystoneclient import client
from keystoneclient import discover
from keystoneclient import exceptions
from keystoneclient import fixture
from keystoneclient import session
from keystoneclient.tests.unit import utils
from keystoneclient.v2_0 import client as v2_client
from keystoneclient.v3 import client as v3_client
from keystoneauth import _discover
from keystoneauth.auth import token_endpoint
from keystoneauth import client
from keystoneauth import discover
from keystoneauth import exceptions
from keystoneauth import fixture
from keystoneauth import session
from keystoneauth.tests.unit import utils
from keystoneauth.v2_0 import client as v2_client
from keystoneauth.v3 import client as v3_client
BASE_HOST = 'http://keystone.example.com'

View File

@ -16,8 +16,8 @@ import mock
import pep8
import testtools
from keystoneclient.hacking import checks
from keystoneclient.tests.unit import client_fixtures
from keystoneauth.hacking import checks
from keystoneauth.tests.unit import client_fixtures
class TestCheckOsloNamespaceImports(testtools.TestCase):

View File

@ -23,12 +23,12 @@ import requests
import six
from testtools import matchers
from keystoneclient import adapter
from keystoneclient.auth import base
from keystoneclient import exceptions
from keystoneclient.i18n import _
from keystoneclient import session as client_session
from keystoneclient.tests.unit import utils
from keystoneauth import adapter
from keystoneauth.auth import base
from keystoneauth import exceptions
from keystoneauth.i18n import _
from keystoneauth import session as client_session
from keystoneauth.tests.unit import utils
class SessionTests(utils.TestCase):

View 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

View File

@ -21,7 +21,7 @@ from oslo_utils import encodeutils
import prettytable
import six
from keystoneclient import exceptions
from keystoneauth import exceptions
logger = logging.getLogger(__name__)

View File

@ -3,7 +3,6 @@
# The list of modules to copy from oslo-incubator
module=apiclient
module=install_venv_common
module=memorycache
# The base module to hold the copy of openstack.common
base=keystoneclient
base=keystoneauth

View File

@ -1,6 +1,6 @@
[metadata]
name = python-keystoneclient
summary = Client Library for OpenStack Identity
name = keystoneauth
summary = Authentication Libarary for OpenStack Identity
description-file =
README.rst
author = OpenStack
@ -21,22 +21,20 @@ classifier =
[files]
packages =
keystoneclient
keystoneauth
[entry_points]
console_scripts =
keystone = keystoneclient.shell:main
keystoneclient.auth.plugin =
password = keystoneclient.auth.identity.generic:Password
token = keystoneclient.auth.identity.generic:Token
v2password = keystoneclient.auth.identity.v2:Password
v2token = keystoneclient.auth.identity.v2:Token
v3password = keystoneclient.auth.identity.v3:Password
v3token = keystoneclient.auth.identity.v3:Token
v3unscopedsaml = keystoneclient.contrib.auth.v3.saml2:Saml2UnscopedToken
v3scopedsaml = keystoneclient.contrib.auth.v3.saml2:Saml2ScopedToken
v3unscopedadfs = keystoneclient.contrib.auth.v3.saml2:ADFSUnscopedToken
keystoneauth.auth.plugin =
password = keystoneauth.auth.identity.generic:Password
token = keystoneauth.auth.identity.generic:Token
v2password = keystoneauth.auth.identity.v2:Password
v2token = keystoneauth.auth.identity.v2:Token
v3password = keystoneauth.auth.identity.v3:Password
v3token = keystoneauth.auth.identity.v3:Token
v3unscopedsaml = keystoneauth.contrib.auth.v3.saml2:Saml2UnscopedToken
v3scopedsaml = keystoneauth.contrib.auth.v3.saml2:Saml2ScopedToken
v3unscopedadfs = keystoneauth.contrib.auth.v3.saml2:ADFSUnscopedToken
[build_sphinx]
source-dir = doc/source
@ -50,18 +48,18 @@ warnerrors = True
upload-dir = doc/build/html
[compile_catalog]
directory = keystoneclient/locale
domain = keystoneclient
directory = keystoneauth/locale
domain = keystoneauth
[update_catalog]
domain = keystoneclient
output_dir = keystoneclient/locale
input_file = keystoneclient/locale/keystoneclient.pot
domain = keystoneauth
output_dir = keystoneauth/locale
input_file = keystoneauth/locale/keystoneauth.pot
[extract_messages]
keywords = _ gettext ngettext l_ lazy_gettext
mapping_file = babel.cfg
output_file = keystoneclient/locale/keystoneclient.pot
output_file = keystoneauth/locale/keystoneauth.pot
[wheel]
universal = 1

View File

@ -28,10 +28,10 @@ commands = python setup.py testr --coverage --testr-args='{posargs}'
downloadcache = ~/cache/pip
[testenv:debug]
commands = oslo_debug_helper -t keystoneclient/tests {posargs}
commands = oslo_debug_helper -t keystoneauth/tests {posargs}
[testenv:functional]
setenv = OS_TEST_PATH=./keystoneclient/tests/functional
setenv = OS_TEST_PATH=./keystoneauth/tests/functional
[flake8]
# H405: multi line docstring summary not separated with an empty line
@ -45,5 +45,5 @@ commands=
[hacking]
import_exceptions =
keystoneclient.i18n
local-check-factory = keystoneclient.hacking.checks.factory
keystoneauth.i18n
local-check-factory = keystoneauth.hacking.checks.factory