summaryrefslogtreecommitdiff
path: root/keystone
diff options
context:
space:
mode:
Diffstat (limited to 'keystone')
-rw-r--r--keystone/api/os_ep_filter.py2
-rw-r--r--keystone/api/os_oauth2.py13
-rw-r--r--keystone/cmd/doctor/database.py2
-rw-r--r--keystone/common/sql/migrations/versions/27e647c0fad4_initial_version.py2
-rw-r--r--keystone/common/sql/upgrades.py4
-rw-r--r--keystone/federation/utils.py2
-rw-r--r--keystone/revoke/backends/base.py4
-rw-r--r--keystone/tests/unit/test_sql_upgrade.py1
-rw-r--r--keystone/tests/unit/test_v3_oauth2.py20
9 files changed, 16 insertions, 34 deletions
diff --git a/keystone/api/os_ep_filter.py b/keystone/api/os_ep_filter.py
index c26098347..055d21deb 100644
--- a/keystone/api/os_ep_filter.py
+++ b/keystone/api/os_ep_filter.py
@@ -110,7 +110,7 @@ class EndpointGroupsResource(ks_flask.ResourceBase):
class EPFilterEndpointProjectsResource(flask_restful.Resource):
def get(self, endpoint_id):
- """"Return a list of projects associated with the endpoint."""
+ """Return a list of projects associated with the endpoint."""
ENFORCER.enforce_call(action='identity:list_projects_for_endpoint')
PROVIDERS.catalog_api.get_endpoint(endpoint_id)
refs = PROVIDERS.catalog_api.list_projects_for_endpoint(endpoint_id)
diff --git a/keystone/api/os_oauth2.py b/keystone/api/os_oauth2.py
index ed37eacaa..43e3dfcbe 100644
--- a/keystone/api/os_oauth2.py
+++ b/keystone/api/os_oauth2.py
@@ -32,7 +32,7 @@ _build_resource_relation = json_home_relations.os_oauth2_resource_rel_func
class AccessTokenResource(ks_flask.ResourceBase):
def _method_not_allowed(self):
- """Raise a method not allowed error"""
+ """Raise a method not allowed error."""
raise exception.OAuth2OtherError(
int(http.client.METHOD_NOT_ALLOWED),
http.client.responses[http.client.METHOD_NOT_ALLOWED],
@@ -40,27 +40,27 @@ class AccessTokenResource(ks_flask.ResourceBase):
@ks_flask.unenforced_api
def get(self):
- """The method is not allowed"""
+ """The method is not allowed."""
self._method_not_allowed()
@ks_flask.unenforced_api
def head(self):
- """The method is not allowed"""
+ """The method is not allowed."""
self._method_not_allowed()
@ks_flask.unenforced_api
def put(self):
- """The method is not allowed"""
+ """The method is not allowed."""
self._method_not_allowed()
@ks_flask.unenforced_api
def patch(self):
- """The method is not allowed"""
+ """The method is not allowed."""
self._method_not_allowed()
@ks_flask.unenforced_api
def delete(self):
- """The method is not allowed"""
+ """The method is not allowed."""
self._method_not_allowed()
@ks_flask.unenforced_api
@@ -69,7 +69,6 @@ class AccessTokenResource(ks_flask.ResourceBase):
POST /v3/OS-OAUTH2/token
"""
-
client_auth = flask.request.authorization
if not client_auth:
error = exception.OAuth2InvalidClient(
diff --git a/keystone/cmd/doctor/database.py b/keystone/cmd/doctor/database.py
index e0def5d63..95c5bdd87 100644
--- a/keystone/cmd/doctor/database.py
+++ b/keystone/cmd/doctor/database.py
@@ -23,7 +23,7 @@ def symptom_database_connection_is_not_SQLite():
migrations, making it unsuitable for use in keystone. Please change your
`keystone.conf [database] connection` value to point to a supported
database driver, such as MySQL.
- """
+ """ # noqa: D403
return (
CONF.database.connection is not None
and 'sqlite' in CONF.database.connection)
diff --git a/keystone/common/sql/migrations/versions/27e647c0fad4_initial_version.py b/keystone/common/sql/migrations/versions/27e647c0fad4_initial_version.py
index eec97c573..0f4994903 100644
--- a/keystone/common/sql/migrations/versions/27e647c0fad4_initial_version.py
+++ b/keystone/common/sql/migrations/versions/27e647c0fad4_initial_version.py
@@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-"""Initial version
+"""Initial version.
Revision ID: 27e647c0fad4
Revises:
diff --git a/keystone/common/sql/upgrades.py b/keystone/common/sql/upgrades.py
index 41a094819..a075716e9 100644
--- a/keystone/common/sql/upgrades.py
+++ b/keystone/common/sql/upgrades.py
@@ -51,7 +51,7 @@ VERSIONS_PATH = os.path.join(
def _find_migrate_repo(branch):
- """Get the project's change script repository
+ """Get the project's change script repository.
:param branch: Name of the repository "branch" to be used; this will be
transformed to repository path.
@@ -70,7 +70,7 @@ def _find_migrate_repo(branch):
def _find_alembic_conf():
- """Get the project's alembic configuration
+ """Get the project's alembic configuration.
:returns: An instance of ``alembic.config.Config``
"""
diff --git a/keystone/federation/utils.py b/keystone/federation/utils.py
index 5f53dfbb5..7c1f0c901 100644
--- a/keystone/federation/utils.py
+++ b/keystone/federation/utils.py
@@ -251,7 +251,7 @@ class DirectMaps(object):
self._matches = []
def __str__(self):
- """return the direct map array as a string."""
+ """Return the direct map array as a string."""
return '%s' % self._matches
def add(self, values):
diff --git a/keystone/revoke/backends/base.py b/keystone/revoke/backends/base.py
index 228db4d5c..52ee957dc 100644
--- a/keystone/revoke/backends/base.py
+++ b/keystone/revoke/backends/base.py
@@ -36,7 +36,7 @@ class RevokeDriverBase(object, metaclass=abc.ABCMeta):
@abc.abstractmethod
def list_events(self, last_fetch=None, token=None):
- """return the revocation events, as a list of objects.
+ """Return the revocation events, as a list of objects.
:param last_fetch: Time of last fetch. Return all events newer.
:param token: dictionary of values from a token, normalized for
@@ -52,7 +52,7 @@ class RevokeDriverBase(object, metaclass=abc.ABCMeta):
@abc.abstractmethod
def revoke(self, event):
- """register a revocation event.
+ """Register a revocation event.
:param event: An instance of
keystone.revoke.model.RevocationEvent
diff --git a/keystone/tests/unit/test_sql_upgrade.py b/keystone/tests/unit/test_sql_upgrade.py
index 55440c955..5a8211881 100644
--- a/keystone/tests/unit/test_sql_upgrade.py
+++ b/keystone/tests/unit/test_sql_upgrade.py
@@ -228,6 +228,7 @@ class MigrateBase(
db_fixtures.OpportunisticDBTestMixin,
):
"""Test complete orchestration between all database phases."""
+
def setUp(self):
super().setUp()
diff --git a/keystone/tests/unit/test_v3_oauth2.py b/keystone/tests/unit/test_v3_oauth2.py
index 5d01e8953..3dcee1a04 100644
--- a/keystone/tests/unit/test_v3_oauth2.py
+++ b/keystone/tests/unit/test_v3_oauth2.py
@@ -113,8 +113,7 @@ class AccessTokenTests(OAuth2Tests):
def _create_access_token(self, client):
pass
- def _get_access_token_method_not_allowed(self, app_cred,
- http_func):
+ def _get_access_token_method_not_allowed(self, app_cred, http_func):
client_id = app_cred.get('id')
client_secret = app_cred.get('secret')
b64str = b64encode(
@@ -139,7 +138,6 @@ class AccessTokenTests(OAuth2Tests):
def test_get_access_token(self):
"""Test case when an access token can be successfully obtain."""
-
client_name = 'client_name_test'
app_cred = self._create_app_cred(self.user_id, client_name)
resp = self._get_access_token(
@@ -155,7 +153,6 @@ class AccessTokenTests(OAuth2Tests):
def test_get_access_token_without_client_auth(self):
"""Test case when there is no client authorization."""
-
client_name = 'client_name_test'
app_cred = self._create_app_cred(self.user_id, client_name)
headers = {
@@ -181,7 +178,6 @@ class AccessTokenTests(OAuth2Tests):
def test_get_access_token_auth_type_is_not_basic(self):
"""Test case when auth_type is not basic."""
-
client_name = 'client_name_test'
app_cred = self._create_app_cred(self.user_id, client_name)
client_id = app_cred.get('id')
@@ -215,7 +211,6 @@ class AccessTokenTests(OAuth2Tests):
def test_get_access_token_without_client_id(self):
"""Test case when there is no client_id."""
-
client_name = 'client_name_test'
app_cred = self._create_app_cred(self.user_id, client_name)
client_secret = app_cred.get('secret')
@@ -241,7 +236,6 @@ class AccessTokenTests(OAuth2Tests):
def test_get_access_token_without_client_secret(self):
"""Test case when there is no client_secret."""
-
client_name = 'client_name_test'
app_cred = self._create_app_cred(self.user_id, client_name)
client_id = app_cred.get('id')
@@ -267,7 +261,6 @@ class AccessTokenTests(OAuth2Tests):
def test_get_access_token_without_grant_type(self):
"""Test case when there is no grant_type."""
-
client_name = 'client_name_test'
app_cred = self._create_app_cred(self.user_id, client_name)
data = {}
@@ -288,7 +281,6 @@ class AccessTokenTests(OAuth2Tests):
def test_get_access_token_blank_grant_type(self):
"""Test case when grant_type is blank."""
-
client_name = 'client_name_test'
app_cred = self._create_app_cred(self.user_id, client_name)
data = {
@@ -312,7 +304,6 @@ class AccessTokenTests(OAuth2Tests):
def test_get_access_token_grant_type_is_not_client_credentials(self):
"""Test case when grant_type is not client_credentials."""
-
client_name = 'client_name_test'
app_cred = self._create_app_cred(self.user_id, client_name)
data = {
@@ -336,7 +327,6 @@ class AccessTokenTests(OAuth2Tests):
def test_get_access_token_failed_401(self):
"""Test case when client authentication failed."""
-
client_name = 'client_name_test'
app_cred = self._create_app_cred(self.user_id, client_name)
error = 'invalid_client'
@@ -376,7 +366,6 @@ class AccessTokenTests(OAuth2Tests):
def test_get_access_token_failed_400(self):
"""Test case when the called API is incorrect."""
-
client_name = 'client_name_test'
app_cred = self._create_app_cred(self.user_id, client_name)
error = 'invalid_request'
@@ -412,7 +401,6 @@ class AccessTokenTests(OAuth2Tests):
def test_get_access_token_failed_500_other(self):
"""Test case when unexpected error."""
-
client_name = 'client_name_test'
app_cred = self._create_app_cred(self.user_id, client_name)
error = 'other_error'
@@ -448,7 +436,6 @@ class AccessTokenTests(OAuth2Tests):
def test_get_access_token_failed_500(self):
"""Test case when internal server error."""
-
client_name = 'client_name_test'
app_cred = self._create_app_cred(self.user_id, client_name)
error = 'other_error'
@@ -484,7 +471,6 @@ class AccessTokenTests(OAuth2Tests):
def test_get_access_token_method_get_not_allowed(self):
"""Test case when the request is get method that is not allowed."""
-
client_name = 'client_name_test'
app_cred = self._create_app_cred(self.user_id, client_name)
json_resp = self._get_access_token_method_not_allowed(
@@ -496,7 +482,6 @@ class AccessTokenTests(OAuth2Tests):
def test_get_access_token_method_patch_not_allowed(self):
"""Test case when the request is patch method that is not allowed."""
-
client_name = 'client_name_test'
app_cred = self._create_app_cred(self.user_id, client_name)
json_resp = self._get_access_token_method_not_allowed(
@@ -508,7 +493,6 @@ class AccessTokenTests(OAuth2Tests):
def test_get_access_token_method_put_not_allowed(self):
"""Test case when the request is put method that is not allowed."""
-
client_name = 'client_name_test'
app_cred = self._create_app_cred(self.user_id, client_name)
json_resp = self._get_access_token_method_not_allowed(
@@ -520,7 +504,6 @@ class AccessTokenTests(OAuth2Tests):
def test_get_access_token_method_delete_not_allowed(self):
"""Test case when the request is delete method that is not allowed."""
-
client_name = 'client_name_test'
app_cred = self._create_app_cred(self.user_id, client_name)
json_resp = self._get_access_token_method_not_allowed(
@@ -532,7 +515,6 @@ class AccessTokenTests(OAuth2Tests):
def test_get_access_token_method_head_not_allowed(self):
"""Test case when the request is head method that is not allowed."""
-
client_name = 'client_name_test'
app_cred = self._create_app_cred(self.user_id, client_name)
client_id = app_cred.get('id')