From f70d313defd0394efc3344d6345ea9b813f07965 Mon Sep 17 00:00:00 2001 From: Morgan Fainberg Date: Mon, 20 Apr 2015 14:22:07 -0700 Subject: [PATCH] Initial Split of python-keystoneclient to keystoneauth Change-Id: Ib33d022506072749e23caf6d9defbcc9a65c8b48 --- .coveragerc | 4 +- .gitreview | 2 +- .testr.conf | 2 +- CONTRIBUTING.rst | 2 +- HACKING.rst | 2 +- LICENSE | 2 +- .../hacking/__init__.py => README.rst | 0 .../openstack => keystoneauth}/__init__.py | 0 {keystoneclient => keystoneauth}/access.py | 4 +- {keystoneclient => keystoneauth}/adapter.py | 26 +-- .../auth/__init__.py | 6 +- {keystoneclient => keystoneauth}/auth/base.py | 24 +- {keystoneclient => keystoneauth}/auth/cli.py | 12 +- {keystoneclient => keystoneauth}/auth/conf.py | 6 +- .../auth/identity/__init__.py | 8 +- .../auth/identity/access.py | 6 +- .../auth/identity/base.py | 38 ++-- .../auth/identity/generic/__init__.py | 6 +- .../auth/identity/generic/base.py | 10 +- .../auth/identity/generic/password.py | 10 +- .../auth/identity/generic/token.py | 8 +- .../auth/identity/v2.py | 8 +- .../auth/identity/v3/__init__.py | 8 +- .../auth/identity/v3/base.py | 12 +- .../auth/identity/v3/federated.py | 8 +- .../auth/identity/v3/password.py | 2 +- .../auth/identity/v3/token.py | 2 +- .../auth/token_endpoint.py | 2 +- .../exceptions.py | 6 +- .../fixture/__init__.py | 12 +- .../fixture/discovery.py | 2 +- .../fixture/exception.py | 0 .../fixture/v2.py | 2 +- .../fixture/v3.py | 2 +- .../hacking}/__init__.py | 0 .../hacking/checks.py | 4 +- {keystoneclient => keystoneauth}/i18n.py | 2 +- .../openstack}/__init__.py | 0 .../openstack/common}/__init__.py | 0 .../openstack/common/_i18n.py | 2 +- .../openstack/common/apiclient/__init__.py | 0 .../openstack/common/apiclient/auth.py | 4 +- .../openstack/common/apiclient/base.py | 4 +- .../openstack/common/apiclient/client.py | 10 +- .../openstack/common/apiclient/exceptions.py | 2 +- .../openstack/common/apiclient/fake_client.py | 2 +- .../openstack/common/apiclient/utils.py | 6 +- .../openstack/common/memorycache.py | 0 .../openstack/common/uuidutils.py | 0 .../service_catalog.py | 6 +- {keystoneclient => keystoneauth}/session.py | 50 ++--- keystoneauth/tests/__init__.py | 0 keystoneauth/tests/unit/__init__.py | 0 keystoneauth/tests/unit/auth/__init__.py | 0 .../tests/unit/auth/test_access.py | 12 +- .../tests/unit/auth/test_cli.py | 6 +- .../tests/unit/auth/test_conf.py | 12 +- .../tests/unit/auth/test_identity_common.py | 12 +- .../tests/unit/auth/test_identity_v2.py | 8 +- .../tests/unit/auth/test_identity_v3.py | 16 +- .../unit/auth/test_identity_v3_federated.py | 10 +- .../tests/unit/auth/test_loading.py | 2 +- .../tests/unit/auth/test_password.py | 10 +- .../tests/unit/auth/test_token.py | 10 +- .../tests/unit/auth/test_token_endpoint.py | 6 +- .../tests/unit/auth/utils.py | 12 +- .../tests/unit/keystoneauth_fixtures.py | 74 +++++++ .../tests/unit/test_discovery.py | 20 +- .../tests/unit/test_hacking_checks.py | 4 +- .../tests/unit/test_session.py | 12 +- keystoneauth/tests/unit/utils.py | 209 ++++++++++++++++++ {keystoneclient => keystoneauth}/utils.py | 2 +- openstack-common.conf | 3 +- setup.cfg | 40 ++-- tox.ini | 8 +- 75 files changed, 552 insertions(+), 272 deletions(-) rename keystoneclient/hacking/__init__.py => README.rst (100%) rename {keystoneclient/openstack => keystoneauth}/__init__.py (100%) rename {keystoneclient => keystoneauth}/access.py (99%) rename {keystoneclient => keystoneauth}/adapter.py (90%) rename {keystoneclient => keystoneauth}/auth/__init__.py (86%) rename {keystoneclient => keystoneauth}/auth/base.py (94%) rename {keystoneclient => keystoneauth}/auth/cli.py (89%) rename {keystoneclient => keystoneauth}/auth/conf.py (95%) rename {keystoneclient => keystoneauth}/auth/identity/__init__.py (83%) rename {keystoneclient => keystoneauth}/auth/identity/access.py (93%) rename {keystoneclient => keystoneauth}/auth/identity/base.py (90%) rename {keystoneclient => keystoneauth}/auth/identity/generic/__init__.py (73%) rename {keystoneclient => keystoneauth}/auth/identity/generic/base.py (96%) rename {keystoneclient => keystoneauth}/auth/identity/generic/password.py (93%) rename {keystoneclient => keystoneauth}/auth/identity/generic/token.py (89%) rename {keystoneclient => keystoneauth}/auth/identity/v2.py (97%) rename {keystoneclient => keystoneauth}/auth/identity/v3/__init__.py (75%) rename {keystoneclient => keystoneauth}/auth/identity/v3/base.py (97%) rename {keystoneclient => keystoneauth}/auth/identity/v3/federated.py (94%) rename {keystoneclient => keystoneauth}/auth/identity/v3/password.py (98%) rename {keystoneclient => keystoneauth}/auth/identity/v3/token.py (97%) rename {keystoneclient => keystoneauth}/auth/token_endpoint.py (97%) rename {keystoneclient => keystoneauth}/exceptions.py (94%) rename {keystoneclient => keystoneauth}/fixture/__init__.py (73%) rename {keystoneclient => keystoneauth}/fixture/discovery.py (99%) rename {keystoneclient => keystoneauth}/fixture/exception.py (100%) rename {keystoneclient => keystoneauth}/fixture/v2.py (99%) rename {keystoneclient => keystoneauth}/fixture/v3.py (99%) rename {keystoneclient/openstack/common => keystoneauth/hacking}/__init__.py (100%) rename {keystoneclient => keystoneauth}/hacking/checks.py (90%) rename {keystoneclient => keystoneauth}/i18n.py (94%) rename {keystoneclient/openstack/common/apiclient => keystoneauth/openstack}/__init__.py (100%) rename {keystoneclient/tests/unit/auth => keystoneauth/openstack/common}/__init__.py (100%) rename {keystoneclient => keystoneauth}/openstack/common/_i18n.py (95%) create mode 100644 keystoneauth/openstack/common/apiclient/__init__.py rename {keystoneclient => keystoneauth}/openstack/common/apiclient/auth.py (98%) rename {keystoneclient => keystoneauth}/openstack/common/apiclient/base.py (99%) rename {keystoneclient => keystoneauth}/openstack/common/apiclient/client.py (97%) rename {keystoneclient => keystoneauth}/openstack/common/apiclient/exceptions.py (99%) rename {keystoneclient => keystoneauth}/openstack/common/apiclient/fake_client.py (98%) rename {keystoneclient => keystoneauth}/openstack/common/apiclient/utils.py (94%) rename {keystoneclient => keystoneauth}/openstack/common/memorycache.py (100%) rename {keystoneclient => keystoneauth}/openstack/common/uuidutils.py (100%) rename {keystoneclient => keystoneauth}/service_catalog.py (99%) rename {keystoneclient => keystoneauth}/session.py (95%) create mode 100644 keystoneauth/tests/__init__.py create mode 100644 keystoneauth/tests/unit/__init__.py create mode 100644 keystoneauth/tests/unit/auth/__init__.py rename {keystoneclient => keystoneauth}/tests/unit/auth/test_access.py (89%) rename {keystoneclient => keystoneauth}/tests/unit/auth/test_cli.py (98%) rename {keystoneclient => keystoneauth}/tests/unit/auth/test_conf.py (96%) rename {keystoneclient => keystoneauth}/tests/unit/auth/test_identity_common.py (98%) rename {keystoneclient => keystoneauth}/tests/unit/auth/test_identity_v2.py (98%) rename {keystoneclient => keystoneauth}/tests/unit/auth/test_identity_v3.py (98%) rename {keystoneclient => keystoneauth}/tests/unit/auth/test_identity_v3_federated.py (94%) rename {keystoneclient => keystoneauth}/tests/unit/auth/test_loading.py (96%) rename {keystoneclient => keystoneauth}/tests/unit/auth/test_password.py (89%) rename {keystoneclient => keystoneauth}/tests/unit/auth/test_token.py (86%) rename {keystoneclient => keystoneauth}/tests/unit/auth/test_token_endpoint.py (94%) rename {keystoneclient => keystoneauth}/tests/unit/auth/utils.py (96%) create mode 100644 keystoneauth/tests/unit/keystoneauth_fixtures.py rename {keystoneclient => keystoneauth}/tests/unit/test_discovery.py (98%) rename {keystoneclient => keystoneauth}/tests/unit/test_hacking_checks.py (94%) rename {keystoneclient => keystoneauth}/tests/unit/test_session.py (99%) create mode 100644 keystoneauth/tests/unit/utils.py rename {keystoneclient => keystoneauth}/utils.py (99%) diff --git a/.coveragerc b/.coveragerc index f024452c..b171fa61 100644 --- a/.coveragerc +++ b/.coveragerc @@ -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 diff --git a/.gitreview b/.gitreview index 56224f5d..96e3cc03 100644 --- a/.gitreview +++ b/.gitreview @@ -1,4 +1,4 @@ [gerrit] host=review.openstack.org port=29418 -project=openstack/python-keystoneclient.git +project=openstack/keystoneauth.git diff --git a/.testr.conf b/.testr.conf index 3d3e1e6e..32d0b7ad 100644 --- a/.testr.conf +++ b/.testr.conf @@ -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 diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index b7139ecc..00948370 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -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 diff --git a/HACKING.rst b/HACKING.rst index 0dfef990..11f0b6c8 100644 --- a/HACKING.rst +++ b/HACKING.rst @@ -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: diff --git a/LICENSE b/LICENSE index 32b66114..af613b13 100644 --- a/LICENSE +++ b/LICENSE @@ -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. diff --git a/keystoneclient/hacking/__init__.py b/README.rst similarity index 100% rename from keystoneclient/hacking/__init__.py rename to README.rst diff --git a/keystoneclient/openstack/__init__.py b/keystoneauth/__init__.py similarity index 100% rename from keystoneclient/openstack/__init__.py rename to keystoneauth/__init__.py diff --git a/keystoneclient/access.py b/keystoneauth/access.py similarity index 99% rename from keystoneclient/access.py rename to keystoneauth/access.py index 009b72e0..a50bba88 100644 --- a/keystoneclient/access.py +++ b/keystoneauth/access.py @@ -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 diff --git a/keystoneclient/adapter.py b/keystoneauth/adapter.py similarity index 90% rename from keystoneclient/adapter.py rename to keystoneauth/adapter.py index 74399da1..de3ff62c 100644 --- a/keystoneclient/adapter.py +++ b/keystoneauth/adapter.py @@ -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. diff --git a/keystoneclient/auth/__init__.py b/keystoneauth/auth/__init__.py similarity index 86% rename from keystoneclient/auth/__init__.py rename to keystoneauth/auth/__init__.py index 463bcef4..b4715c95 100644 --- a/keystoneclient/auth/__init__.py +++ b/keystoneauth/auth/__init__.py @@ -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__ = [ diff --git a/keystoneclient/auth/base.py b/keystoneauth/auth/base.py similarity index 94% rename from keystoneclient/auth/base.py rename to keystoneauth/auth/base.py index 91cf86ad..418f288a 100644 --- a/keystoneclient/auth/base.py +++ b/keystoneauth/auth/base.py @@ -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() diff --git a/keystoneclient/auth/cli.py b/keystoneauth/auth/cli.py similarity index 89% rename from keystoneclient/auth/cli.py rename to keystoneauth/auth/cli.py index 40a81c1d..24241a06 100644 --- a/keystoneclient/auth/cli.py +++ b/keystoneauth/auth/cli.py @@ -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: diff --git a/keystoneclient/auth/conf.py b/keystoneauth/auth/conf.py similarity index 95% rename from keystoneclient/auth/conf.py rename to keystoneauth/auth/conf.py index b61c123c..fe437a67 100644 --- a/keystoneclient/auth/conf.py +++ b/keystoneauth/auth/conf.py @@ -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 diff --git a/keystoneclient/auth/identity/__init__.py b/keystoneauth/auth/identity/__init__.py similarity index 83% rename from keystoneclient/auth/identity/__init__.py rename to keystoneauth/auth/identity/__init__.py index d2aca8f9..e5692a1c 100644 --- a/keystoneclient/auth/identity/__init__.py +++ b/keystoneauth/auth/identity/__init__.py @@ -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 diff --git a/keystoneclient/auth/identity/access.py b/keystoneauth/auth/identity/access.py similarity index 93% rename from keystoneclient/auth/identity/access.py rename to keystoneauth/auth/identity/access.py index 46df3bfd..110c38b3 100644 --- a/keystoneclient/auth/identity/access.py +++ b/keystoneauth/auth/identity/access.py @@ -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) """ diff --git a/keystoneclient/auth/identity/base.py b/keystoneauth/auth/identity/base.py similarity index 90% rename from keystoneclient/auth/identity/base.py rename to keystoneauth/auth/identity/base.py index 75c6d7f6..53fa0bbd 100644 --- a/keystoneclient/auth/identity/base.py +++ b/keystoneauth/auth/identity/base.py @@ -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. diff --git a/keystoneclient/auth/identity/generic/__init__.py b/keystoneauth/auth/identity/generic/__init__.py similarity index 73% rename from keystoneclient/auth/identity/generic/__init__.py rename to keystoneauth/auth/identity/generic/__init__.py index b24c3d64..1a0e3ff7 100644 --- a/keystoneclient/auth/identity/generic/__init__.py +++ b/keystoneauth/auth/identity/generic/__init__.py @@ -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', diff --git a/keystoneclient/auth/identity/generic/base.py b/keystoneauth/auth/identity/generic/base.py similarity index 96% rename from keystoneclient/auth/identity/generic/base.py rename to keystoneauth/auth/identity/generic/base.py index 7e148d2c..49578183 100644 --- a/keystoneclient/auth/identity/generic/base.py +++ b/keystoneauth/auth/identity/generic/base.py @@ -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. diff --git a/keystoneclient/auth/identity/generic/password.py b/keystoneauth/auth/identity/generic/password.py similarity index 93% rename from keystoneclient/auth/identity/generic/password.py rename to keystoneauth/auth/identity/generic/password.py index 6790fe22..82630c68 100644 --- a/keystoneclient/auth/identity/generic/password.py +++ b/keystoneauth/auth/identity/generic/password.py @@ -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__) diff --git a/keystoneclient/auth/identity/generic/token.py b/keystoneauth/auth/identity/generic/token.py similarity index 89% rename from keystoneclient/auth/identity/generic/token.py rename to keystoneauth/auth/identity/generic/token.py index 0fbacf04..5fa7440d 100644 --- a/keystoneclient/auth/identity/generic/token.py +++ b/keystoneauth/auth/identity/generic/token.py @@ -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__) diff --git a/keystoneclient/auth/identity/v2.py b/keystoneauth/auth/identity/v2.py similarity index 97% rename from keystoneclient/auth/identity/v2.py rename to keystoneauth/auth/identity/v2.py index 8eaa9c59..d59651cb 100644 --- a/keystoneclient/auth/identity/v2.py +++ b/keystoneauth/auth/identity/v2.py @@ -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__) diff --git a/keystoneclient/auth/identity/v3/__init__.py b/keystoneauth/auth/identity/v3/__init__.py similarity index 75% rename from keystoneclient/auth/identity/v3/__init__.py rename to keystoneauth/auth/identity/v3/__init__.py index a08f3ecc..297f716d 100644 --- a/keystoneclient/auth/identity/v3/__init__.py +++ b/keystoneauth/auth/identity/v3/__init__.py @@ -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', diff --git a/keystoneclient/auth/identity/v3/base.py b/keystoneauth/auth/identity/v3/base.py similarity index 97% rename from keystoneclient/auth/identity/v3/base.py rename to keystoneauth/auth/identity/v3/base.py index 9d1f5627..22053cb7 100644 --- a/keystoneclient/auth/identity/v3/base.py +++ b/keystoneauth/auth/identity/v3/base.py @@ -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. diff --git a/keystoneclient/auth/identity/v3/federated.py b/keystoneauth/auth/identity/v3/federated.py similarity index 94% rename from keystoneclient/auth/identity/v3/federated.py rename to keystoneauth/auth/identity/v3/federated.py index db7ad2b9..263d36b7 100644 --- a/keystoneclient/auth/identity/v3/federated.py +++ b/keystoneauth/auth/identity/v3/federated.py @@ -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) diff --git a/keystoneclient/auth/identity/v3/password.py b/keystoneauth/auth/identity/v3/password.py similarity index 98% rename from keystoneclient/auth/identity/v3/password.py rename to keystoneauth/auth/identity/v3/password.py index 7e432faa..da0e6a4f 100644 --- a/keystoneclient/auth/identity/v3/password.py +++ b/keystoneauth/auth/identity/v3/password.py @@ -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'] diff --git a/keystoneclient/auth/identity/v3/token.py b/keystoneauth/auth/identity/v3/token.py similarity index 97% rename from keystoneclient/auth/identity/v3/token.py rename to keystoneauth/auth/identity/v3/token.py index d92d3fcc..2dc622f1 100644 --- a/keystoneclient/auth/identity/v3/token.py +++ b/keystoneauth/auth/identity/v3/token.py @@ -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'] diff --git a/keystoneclient/auth/token_endpoint.py b/keystoneauth/auth/token_endpoint.py similarity index 97% rename from keystoneclient/auth/token_endpoint.py rename to keystoneauth/auth/token_endpoint.py index 40550629..ae988b2b 100644 --- a/keystoneclient/auth/token_endpoint.py +++ b/keystoneauth/auth/token_endpoint.py @@ -12,7 +12,7 @@ from oslo_config import cfg -from keystoneclient.auth import base +from keystoneauth.auth import base class Token(base.BaseAuthPlugin): diff --git a/keystoneclient/exceptions.py b/keystoneauth/exceptions.py similarity index 94% rename from keystoneclient/exceptions.py rename to keystoneauth/exceptions.py index 0150bf52..e24eebb2 100644 --- a/keystoneclient/exceptions.py +++ b/keystoneauth/exceptions.py @@ -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): diff --git a/keystoneclient/fixture/__init__.py b/keystoneauth/fixture/__init__.py similarity index 73% rename from keystoneclient/fixture/__init__.py rename to keystoneauth/fixture/__init__.py index ad937040..4122eaae 100644 --- a/keystoneclient/fixture/__init__.py +++ b/keystoneauth/fixture/__init__.py @@ -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', diff --git a/keystoneclient/fixture/discovery.py b/keystoneauth/fixture/discovery.py similarity index 99% rename from keystoneclient/fixture/discovery.py rename to keystoneauth/fixture/discovery.py index eae0bcdc..5040c2d3 100644 --- a/keystoneclient/fixture/discovery.py +++ b/keystoneauth/fixture/discovery.py @@ -14,7 +14,7 @@ import datetime from oslo_utils import timeutils -from keystoneclient import utils +from keystoneauth import utils __all__ = ['DiscoveryList', 'V2Discovery', diff --git a/keystoneclient/fixture/exception.py b/keystoneauth/fixture/exception.py similarity index 100% rename from keystoneclient/fixture/exception.py rename to keystoneauth/fixture/exception.py diff --git a/keystoneclient/fixture/v2.py b/keystoneauth/fixture/v2.py similarity index 99% rename from keystoneclient/fixture/v2.py rename to keystoneauth/fixture/v2.py index bbac2dcb..f516d9e5 100644 --- a/keystoneclient/fixture/v2.py +++ b/keystoneauth/fixture/v2.py @@ -15,7 +15,7 @@ import uuid from oslo_utils import timeutils -from keystoneclient.fixture import exception +from keystoneauth.fixture import exception class _Service(dict): diff --git a/keystoneclient/fixture/v3.py b/keystoneauth/fixture/v3.py similarity index 99% rename from keystoneclient/fixture/v3.py rename to keystoneauth/fixture/v3.py index 646e46db..2da6fa7a 100644 --- a/keystoneclient/fixture/v3.py +++ b/keystoneauth/fixture/v3.py @@ -15,7 +15,7 @@ import uuid from oslo_utils import timeutils -from keystoneclient.fixture import exception +from keystoneauth.fixture import exception class _Service(dict): diff --git a/keystoneclient/openstack/common/__init__.py b/keystoneauth/hacking/__init__.py similarity index 100% rename from keystoneclient/openstack/common/__init__.py rename to keystoneauth/hacking/__init__.py diff --git a/keystoneclient/hacking/checks.py b/keystoneauth/hacking/checks.py similarity index 90% rename from keystoneclient/hacking/checks.py rename to keystoneauth/hacking/checks.py index 42826982..f4f55b81 100644 --- a/keystoneclient/hacking/checks.py +++ b/keystoneauth/hacking/checks.py @@ -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. """ diff --git a/keystoneclient/i18n.py b/keystoneauth/i18n.py similarity index 94% rename from keystoneclient/i18n.py rename to keystoneauth/i18n.py index fc9a52b3..29b87df5 100644 --- a/keystoneclient/i18n.py +++ b/keystoneauth/i18n.py @@ -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 diff --git a/keystoneclient/openstack/common/apiclient/__init__.py b/keystoneauth/openstack/__init__.py similarity index 100% rename from keystoneclient/openstack/common/apiclient/__init__.py rename to keystoneauth/openstack/__init__.py diff --git a/keystoneclient/tests/unit/auth/__init__.py b/keystoneauth/openstack/common/__init__.py similarity index 100% rename from keystoneclient/tests/unit/auth/__init__.py rename to keystoneauth/openstack/common/__init__.py diff --git a/keystoneclient/openstack/common/_i18n.py b/keystoneauth/openstack/common/_i18n.py similarity index 95% rename from keystoneclient/openstack/common/_i18n.py rename to keystoneauth/openstack/common/_i18n.py index 52a5e847..0abd7884 100644 --- a/keystoneclient/openstack/common/_i18n.py +++ b/keystoneauth/openstack/common/_i18n.py @@ -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 diff --git a/keystoneauth/openstack/common/apiclient/__init__.py b/keystoneauth/openstack/common/apiclient/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/keystoneclient/openstack/common/apiclient/auth.py b/keystoneauth/openstack/common/apiclient/auth.py similarity index 98% rename from keystoneclient/openstack/common/apiclient/auth.py rename to keystoneauth/openstack/common/apiclient/auth.py index e68990d5..b3d4f36f 100644 --- a/keystoneclient/openstack/common/apiclient/auth.py +++ b/keystoneauth/openstack/common/apiclient/auth.py @@ -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) diff --git a/keystoneclient/openstack/common/apiclient/base.py b/keystoneauth/openstack/common/apiclient/base.py similarity index 99% rename from keystoneclient/openstack/common/apiclient/base.py rename to keystoneauth/openstack/common/apiclient/base.py index 72d7999d..6db2b69c 100644 --- a/keystoneclient/openstack/common/apiclient/base.py +++ b/keystoneauth/openstack/common/apiclient/base.py @@ -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): diff --git a/keystoneclient/openstack/common/apiclient/client.py b/keystoneauth/openstack/common/apiclient/client.py similarity index 97% rename from keystoneclient/openstack/common/apiclient/client.py rename to keystoneauth/openstack/common/apiclient/client.py index dd560aba..bc14481c 100644 --- a/keystoneclient/openstack/common/apiclient/client.py +++ b/keystoneauth/openstack/common/apiclient/client.py @@ -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() diff --git a/keystoneclient/openstack/common/apiclient/exceptions.py b/keystoneauth/openstack/common/apiclient/exceptions.py similarity index 99% rename from keystoneclient/openstack/common/apiclient/exceptions.py rename to keystoneauth/openstack/common/apiclient/exceptions.py index a4ff25ad..ff199514 100644 --- a/keystoneclient/openstack/common/apiclient/exceptions.py +++ b/keystoneauth/openstack/common/apiclient/exceptions.py @@ -25,7 +25,7 @@ import sys import six -from keystoneclient.openstack.common._i18n import _ +from keystoneauth.openstack.common._i18n import _ class ClientException(Exception): diff --git a/keystoneclient/openstack/common/apiclient/fake_client.py b/keystoneauth/openstack/common/apiclient/fake_client.py similarity index 98% rename from keystoneclient/openstack/common/apiclient/fake_client.py rename to keystoneauth/openstack/common/apiclient/fake_client.py index 46fc5368..e56fc7f5 100644 --- a/keystoneclient/openstack/common/apiclient/fake_client.py +++ b/keystoneauth/openstack/common/apiclient/fake_client.py @@ -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): diff --git a/keystoneclient/openstack/common/apiclient/utils.py b/keystoneauth/openstack/common/apiclient/utils.py similarity index 94% rename from keystoneclient/openstack/common/apiclient/utils.py rename to keystoneauth/openstack/common/apiclient/utils.py index 6aa2975a..17d57989 100644 --- a/keystoneclient/openstack/common/apiclient/utils.py +++ b/keystoneauth/openstack/common/apiclient/utils.py @@ -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): diff --git a/keystoneclient/openstack/common/memorycache.py b/keystoneauth/openstack/common/memorycache.py similarity index 100% rename from keystoneclient/openstack/common/memorycache.py rename to keystoneauth/openstack/common/memorycache.py diff --git a/keystoneclient/openstack/common/uuidutils.py b/keystoneauth/openstack/common/uuidutils.py similarity index 100% rename from keystoneclient/openstack/common/uuidutils.py rename to keystoneauth/openstack/common/uuidutils.py diff --git a/keystoneclient/service_catalog.py b/keystoneauth/service_catalog.py similarity index 99% rename from keystoneclient/service_catalog.py rename to keystoneauth/service_catalog.py index 143a6b7c..92fd210c 100644 --- a/keystoneclient/service_catalog.py +++ b/keystoneauth/service_catalog.py @@ -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) diff --git a/keystoneclient/session.py b/keystoneauth/session.py similarity index 95% rename from keystoneclient/session.py rename to keystoneauth/session.py index 96df8d03..c0d5705d 100644 --- a/keystoneclient/session.py +++ b/keystoneauth/session.py @@ -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. diff --git a/keystoneauth/tests/__init__.py b/keystoneauth/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/keystoneauth/tests/unit/__init__.py b/keystoneauth/tests/unit/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/keystoneauth/tests/unit/auth/__init__.py b/keystoneauth/tests/unit/auth/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/keystoneclient/tests/unit/auth/test_access.py b/keystoneauth/tests/unit/auth/test_access.py similarity index 89% rename from keystoneclient/tests/unit/auth/test_access.py rename to keystoneauth/tests/unit/auth/test_access.py index 405fb8be..ab588591 100644 --- a/keystoneclient/tests/unit/auth/test_access.py +++ b/keystoneauth/tests/unit/auth/test_access.py @@ -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): diff --git a/keystoneclient/tests/unit/auth/test_cli.py b/keystoneauth/tests/unit/auth/test_cli.py similarity index 98% rename from keystoneclient/tests/unit/auth/test_cli.py rename to keystoneauth/tests/unit/auth/test_cli.py index d65de731..a38b7114 100644 --- a/keystoneclient/tests/unit/auth/test_cli.py +++ b/keystoneauth/tests/unit/auth/test_cli.py @@ -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): diff --git a/keystoneclient/tests/unit/auth/test_conf.py b/keystoneauth/tests/unit/auth/test_conf.py similarity index 96% rename from keystoneclient/tests/unit/auth/test_conf.py rename to keystoneauth/tests/unit/auth/test_conf.py index c3ce8eb6..1e325b7c 100644 --- a/keystoneclient/tests/unit/auth/test_conf.py +++ b/keystoneauth/tests/unit/auth/test_conf.py @@ -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): diff --git a/keystoneclient/tests/unit/auth/test_identity_common.py b/keystoneauth/tests/unit/auth/test_identity_common.py similarity index 98% rename from keystoneclient/tests/unit/auth/test_identity_common.py rename to keystoneauth/tests/unit/auth/test_identity_common.py index 3bf04c79..7fdc616b 100644 --- a/keystoneclient/tests/unit/auth/test_identity_common.py +++ b/keystoneauth/tests/unit/auth/test_identity_common.py @@ -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) diff --git a/keystoneclient/tests/unit/auth/test_identity_v2.py b/keystoneauth/tests/unit/auth/test_identity_v2.py similarity index 98% rename from keystoneclient/tests/unit/auth/test_identity_v2.py rename to keystoneauth/tests/unit/auth/test_identity_v2.py index 4c05ee23..a1f1c3c0 100644 --- a/keystoneclient/tests/unit/auth/test_identity_v2.py +++ b/keystoneauth/tests/unit/auth/test_identity_v2.py @@ -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): diff --git a/keystoneclient/tests/unit/auth/test_identity_v3.py b/keystoneauth/tests/unit/auth/test_identity_v3.py similarity index 98% rename from keystoneclient/tests/unit/auth/test_identity_v3.py rename to keystoneauth/tests/unit/auth/test_identity_v3.py index 077ebf53..d064ad85 100644 --- a/keystoneclient/tests/unit/auth/test_identity_v3.py +++ b/keystoneauth/tests/unit/auth/test_identity_v3.py @@ -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): diff --git a/keystoneclient/tests/unit/auth/test_identity_v3_federated.py b/keystoneauth/tests/unit/auth/test_identity_v3_federated.py similarity index 94% rename from keystoneclient/tests/unit/auth/test_identity_v3_federated.py rename to keystoneauth/tests/unit/auth/test_identity_v3_federated.py index b0fa119b..35c32a68 100644 --- a/keystoneclient/tests/unit/auth/test_identity_v3_federated.py +++ b/keystoneauth/tests/unit/auth/test_identity_v3_federated.py @@ -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): diff --git a/keystoneclient/tests/unit/auth/test_loading.py b/keystoneauth/tests/unit/auth/test_loading.py similarity index 96% rename from keystoneclient/tests/unit/auth/test_loading.py rename to keystoneauth/tests/unit/auth/test_loading.py index f8ef3b75..bee74d8f 100644 --- a/keystoneclient/tests/unit/auth/test_loading.py +++ b/keystoneauth/tests/unit/auth/test_loading.py @@ -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): diff --git a/keystoneclient/tests/unit/auth/test_password.py b/keystoneauth/tests/unit/auth/test_password.py similarity index 89% rename from keystoneclient/tests/unit/auth/test_password.py rename to keystoneauth/tests/unit/auth/test_password.py index 2891d8f6..da6e707f 100644 --- a/keystoneclient/tests/unit/auth/test_password.py +++ b/keystoneauth/tests/unit/auth/test_password.py @@ -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): diff --git a/keystoneclient/tests/unit/auth/test_token.py b/keystoneauth/tests/unit/auth/test_token.py similarity index 86% rename from keystoneclient/tests/unit/auth/test_token.py rename to keystoneauth/tests/unit/auth/test_token.py index ce4c1cdc..54c84b2e 100644 --- a/keystoneclient/tests/unit/auth/test_token.py +++ b/keystoneauth/tests/unit/auth/test_token.py @@ -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): diff --git a/keystoneclient/tests/unit/auth/test_token_endpoint.py b/keystoneauth/tests/unit/auth/test_token_endpoint.py similarity index 94% rename from keystoneclient/tests/unit/auth/test_token_endpoint.py rename to keystoneauth/tests/unit/auth/test_token_endpoint.py index b0be8f16..5bdf8f26 100644 --- a/keystoneclient/tests/unit/auth/test_token_endpoint.py +++ b/keystoneauth/tests/unit/auth/test_token_endpoint.py @@ -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): diff --git a/keystoneclient/tests/unit/auth/utils.py b/keystoneauth/tests/unit/auth/utils.py similarity index 96% rename from keystoneclient/tests/unit/auth/utils.py rename to keystoneauth/tests/unit/auth/utils.py index 87c2b62f..eabf8396 100644 --- a/keystoneclient/tests/unit/auth/utils.py +++ b/keystoneauth/tests/unit/auth/utils.py @@ -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): diff --git a/keystoneauth/tests/unit/keystoneauth_fixtures.py b/keystoneauth/tests/unit/keystoneauth_fixtures.py new file mode 100644 index 00000000..ecab99f0 --- /dev/null +++ b/keystoneauth/tests/unit/keystoneauth_fixtures.py @@ -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'), + ], + } diff --git a/keystoneclient/tests/unit/test_discovery.py b/keystoneauth/tests/unit/test_discovery.py similarity index 98% rename from keystoneclient/tests/unit/test_discovery.py rename to keystoneauth/tests/unit/test_discovery.py index 76aaf037..6f527681 100644 --- a/keystoneclient/tests/unit/test_discovery.py +++ b/keystoneauth/tests/unit/test_discovery.py @@ -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' diff --git a/keystoneclient/tests/unit/test_hacking_checks.py b/keystoneauth/tests/unit/test_hacking_checks.py similarity index 94% rename from keystoneclient/tests/unit/test_hacking_checks.py rename to keystoneauth/tests/unit/test_hacking_checks.py index 220d258c..b04105e5 100644 --- a/keystoneclient/tests/unit/test_hacking_checks.py +++ b/keystoneauth/tests/unit/test_hacking_checks.py @@ -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): diff --git a/keystoneclient/tests/unit/test_session.py b/keystoneauth/tests/unit/test_session.py similarity index 99% rename from keystoneclient/tests/unit/test_session.py rename to keystoneauth/tests/unit/test_session.py index d5210972..fe0a2dd4 100644 --- a/keystoneclient/tests/unit/test_session.py +++ b/keystoneauth/tests/unit/test_session.py @@ -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): diff --git a/keystoneauth/tests/unit/utils.py b/keystoneauth/tests/unit/utils.py new file mode 100644 index 00000000..b3405fbc --- /dev/null +++ b/keystoneauth/tests/unit/utils.py @@ -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 diff --git a/keystoneclient/utils.py b/keystoneauth/utils.py similarity index 99% rename from keystoneclient/utils.py rename to keystoneauth/utils.py index 7a2739f5..7c8a45e7 100644 --- a/keystoneclient/utils.py +++ b/keystoneauth/utils.py @@ -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__) diff --git a/openstack-common.conf b/openstack-common.conf index 10f7b9b1..dd96fcfc 100644 --- a/openstack-common.conf +++ b/openstack-common.conf @@ -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 diff --git a/setup.cfg b/setup.cfg index e88046e8..8e6b1dba 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 diff --git a/tox.ini b/tox.ini index 56a43200..d62e7feb 100644 --- a/tox.ini +++ b/tox.ini @@ -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