Fix D208: Docstring over indented. (PEP257)
No other PEP257 violations were addressed here. Change-Id: I567fb5681b043b26bea3d358d7a47d88c02249a0
This commit is contained in:
@@ -768,7 +768,7 @@ class V3Controller(wsgi.Application):
|
||||
additional entities or attributes (passed in target_attr), so that
|
||||
they can be referenced by policy rules.
|
||||
|
||||
"""
|
||||
"""
|
||||
if 'is_admin' in context and context['is_admin']:
|
||||
LOG.warning(_LW('RBAC: Bypassing authorization'))
|
||||
else:
|
||||
|
||||
@@ -216,13 +216,13 @@ class Manager(manager.Manager):
|
||||
def check_token(self, token_values):
|
||||
"""Checks the values from a token against the revocation list
|
||||
|
||||
:param token_values: dictionary of values from a token,
|
||||
normalized for differences between v2 and v3. The checked values are a
|
||||
subset of the attributes of model.TokenEvent
|
||||
:param token_values: dictionary of values from a token, normalized for
|
||||
differences between v2 and v3. The checked values
|
||||
are a subset of the attributes of model.TokenEvent
|
||||
|
||||
:raises exception.TokenNotFound: if the token is invalid
|
||||
|
||||
"""
|
||||
"""
|
||||
if self._get_revoke_tree().is_revoked(token_values):
|
||||
raise exception.TokenNotFound(_('Failed to validate token'))
|
||||
|
||||
|
||||
@@ -44,18 +44,18 @@ def init():
|
||||
def enforce(credentials, action, target, do_raise=True):
|
||||
"""Verifies that the action is valid on the target in this context.
|
||||
|
||||
:param credentials: user credentials
|
||||
:param action: string representing the action to be checked, which
|
||||
should be colon separated for clarity.
|
||||
:param target: dictionary representing the object of the action
|
||||
for object creation this should be a dictionary
|
||||
representing the location of the object e.g.
|
||||
{'project_id': object.project_id}
|
||||
:raises: `exception.Forbidden` if verification fails.
|
||||
:param credentials: user credentials
|
||||
:param action: string representing the action to be checked, which should
|
||||
be colon separated for clarity.
|
||||
:param target: dictionary representing the object of the action for object
|
||||
creation this should be a dictionary representing the
|
||||
location of the object e.g. {'project_id':
|
||||
object.project_id}
|
||||
:raises: `exception.Forbidden` if verification fails.
|
||||
|
||||
Actions should be colon separated for clarity. For example:
|
||||
Actions should be colon separated for clarity. For example:
|
||||
|
||||
* identity:list_users
|
||||
* identity:list_users
|
||||
|
||||
"""
|
||||
init()
|
||||
|
||||
@@ -74,8 +74,8 @@ class Resource(resource.ResourceDriverV8):
|
||||
raise ValueError(_('Expected dict or list: %s') % type(ref))
|
||||
|
||||
def _validate_parent_project_is_none(self, ref):
|
||||
"""If a parent_id different from None was given,
|
||||
raises InvalidProjectException.
|
||||
"""If a parent_id different from None was given, raises
|
||||
InvalidProjectException.
|
||||
|
||||
"""
|
||||
parent_id = ref.get('parent_id')
|
||||
|
||||
@@ -177,7 +177,7 @@ class NotificationsTestCase(unit.BaseTestCase):
|
||||
|
||||
def test_send_notification(self):
|
||||
"""Test the private method _send_notification to ensure event_type,
|
||||
payload, and context are built and passed properly.
|
||||
payload, and context are built and passed properly.
|
||||
"""
|
||||
resource = uuid.uuid4().hex
|
||||
resource_type = EXP_RESOURCE_TYPE
|
||||
|
||||
@@ -1243,7 +1243,7 @@ class V2TestCase(RestfulTestCase, CoreApiTests, LegacyV2UsernameTests):
|
||||
|
||||
def test_fetch_revocation_list_md5(self):
|
||||
"""If the server is configured for md5, then the revocation list has
|
||||
tokens hashed with MD5.
|
||||
tokens hashed with MD5.
|
||||
"""
|
||||
|
||||
# The default hash algorithm is md5.
|
||||
@@ -1255,7 +1255,7 @@ class V2TestCase(RestfulTestCase, CoreApiTests, LegacyV2UsernameTests):
|
||||
|
||||
def test_fetch_revocation_list_sha256(self):
|
||||
"""If the server is configured for sha256, then the revocation list has
|
||||
tokens hashed with SHA256
|
||||
tokens hashed with SHA256
|
||||
"""
|
||||
|
||||
hash_algorithm = 'sha256'
|
||||
|
||||
@@ -153,8 +153,7 @@ class TenantTestCase(unit.TestCase):
|
||||
def test_list_is_domain_project_not_found(self):
|
||||
"""Test v2 get_all_projects having projects that act as a domain.
|
||||
|
||||
In v2 no project with the is_domain flag enabled should be
|
||||
returned.
|
||||
In v2 no project with the is_domain flag enabled should be returned.
|
||||
"""
|
||||
project1 = self._create_is_domain_project()
|
||||
project2 = self._create_is_domain_project()
|
||||
|
||||
@@ -958,26 +958,27 @@ class TestTokenRevokeById(test_v3.RestfulTestCase):
|
||||
def test_deleting_role_revokes_token(self):
|
||||
"""Test deleting a role revokes token.
|
||||
|
||||
Add some additional test data, namely:
|
||||
- A third project (project C)
|
||||
- Three additional users - user4 owned by domainB and user5 and 6
|
||||
owned by domainA (different domain ownership should not affect
|
||||
the test results, just provided to broaden test coverage)
|
||||
- User5 is a member of group1
|
||||
- Group1 gets an additional assignment - role1 on projectB as
|
||||
well as its existing role1 on projectA
|
||||
- User4 has role2 on Project C
|
||||
- User6 has role1 on projectA and domainA
|
||||
- This allows us to create 5 tokens by virtue of different types
|
||||
of role assignment:
|
||||
- user1, scoped to ProjectA by virtue of user role1 assignment
|
||||
- user5, scoped to ProjectB by virtue of group role1 assignment
|
||||
- user4, scoped to ProjectC by virtue of user role2 assignment
|
||||
- user6, scoped to ProjectA by virtue of user role1 assignment
|
||||
- user6, scoped to DomainA by virtue of user role1 assignment
|
||||
- role1 is then deleted
|
||||
- Check the tokens on Project A and B, and DomainA are revoked,
|
||||
but not the one for Project C
|
||||
Add some additional test data, namely:
|
||||
|
||||
- A third project (project C)
|
||||
- Three additional users - user4 owned by domainB and user5 and 6 owned
|
||||
by domainA (different domain ownership should not affect the test
|
||||
results, just provided to broaden test coverage)
|
||||
- User5 is a member of group1
|
||||
- Group1 gets an additional assignment - role1 on projectB as well as
|
||||
its existing role1 on projectA
|
||||
- User4 has role2 on Project C
|
||||
- User6 has role1 on projectA and domainA
|
||||
- This allows us to create 5 tokens by virtue of different types of
|
||||
role assignment:
|
||||
- user1, scoped to ProjectA by virtue of user role1 assignment
|
||||
- user5, scoped to ProjectB by virtue of group role1 assignment
|
||||
- user4, scoped to ProjectC by virtue of user role2 assignment
|
||||
- user6, scoped to ProjectA by virtue of user role1 assignment
|
||||
- user6, scoped to DomainA by virtue of user role1 assignment
|
||||
- role1 is then deleted
|
||||
- Check the tokens on Project A and B, and DomainA are revoked, but not
|
||||
the one for Project C
|
||||
|
||||
"""
|
||||
|
||||
|
||||
@@ -245,8 +245,8 @@ class CredentialTestCase(CredentialBaseTestCase):
|
||||
r.result['credential']['id'])
|
||||
|
||||
def test_create_ec2_credential_with_missing_project_id(self):
|
||||
"""Call ``POST /credentials`` for creating ec2
|
||||
credential with missing project_id.
|
||||
"""Call ``POST /credentials`` for creating ec2 credential with missing
|
||||
project_id.
|
||||
"""
|
||||
ref = self.new_credential_ref(user_id=self.user['id'])
|
||||
blob = {"access": uuid.uuid4().hex,
|
||||
@@ -259,8 +259,8 @@ class CredentialTestCase(CredentialBaseTestCase):
|
||||
body={'credential': ref}, expected_status=http_client.BAD_REQUEST)
|
||||
|
||||
def test_create_ec2_credential_with_invalid_blob(self):
|
||||
"""Call ``POST /credentials`` for creating ec2
|
||||
credential with invalid blob.
|
||||
"""Call ``POST /credentials`` for creating ec2 credential with invalid
|
||||
blob.
|
||||
"""
|
||||
ref = self.new_credential_ref(user_id=self.user['id'],
|
||||
project_id=self.project_id)
|
||||
|
||||
@@ -106,13 +106,12 @@ show-source = true
|
||||
# D203: 1 blank required before class docstring.
|
||||
# D204: 1 blank required after class docstring
|
||||
# D205: Blank line required between one-line summary and description.
|
||||
# D208: Docstring over indented.
|
||||
# D210: No whitespaces allowed surrounding docstring text
|
||||
# D300: Use """triple double quotes"""
|
||||
# D400: First line should end with a period.
|
||||
# D401: First line should be in imperative mood.
|
||||
# D402: line should not be the function's "signature".
|
||||
ignore = H405,D100,D101,D102,D103,D104,D105,D200,D202,D203,D204,D205,D208,D210,D300,D400,D401,D402
|
||||
ignore = H405,D100,D101,D102,D103,D104,D105,D200,D202,D203,D204,D205,D210,D300,D400,D401,D402
|
||||
|
||||
exclude=.venv,.git,.tox,build,dist,doc,*openstack/common*,*lib/python*,*egg,tools,vendor,.update-venv,*.ini,*.po,*.pot
|
||||
max-complexity=24
|
||||
|
||||
Reference in New Issue
Block a user