diff --git a/barbican/common/policies/secrets.py b/barbican/common/policies/secrets.py index 1b47f8696..d1f7903f1 100644 --- a/barbican/common/policies/secrets.py +++ b/barbican/common/policies/secrets.py @@ -135,7 +135,7 @@ rules = [ ), policy.DocumentedRuleDefault( name='secrets:post', - check_str=f'True:%(enforce_new_defaults)s and role:member', + check_str='True:%(enforce_new_defaults)s and role:member', scope_types=['project'], description='Creates a Secret entity.', operations=[ @@ -148,7 +148,7 @@ rules = [ ), policy.DocumentedRuleDefault( name='secrets:get', - check_str=f'True:%(enforce_new_defaults)s and role:member', + check_str='True:%(enforce_new_defaults)s and role:member', scope_types=['project'], description='Lists a projects secrets.', operations=[ diff --git a/barbican/hacking/checks.py b/barbican/hacking/checks.py index 33b88f0d5..02964f6d3 100644 --- a/barbican/hacking/checks.py +++ b/barbican/hacking/checks.py @@ -17,7 +17,6 @@ import ast import re from hacking import core -import pycodestyle """ @@ -152,18 +151,18 @@ class CheckLoggingFormatArgs(BaseASTChecker): @core.flake8ext -def check_oslo_namespace_imports(physical_line, logical_line, filename): +def check_oslo_namespace_imports(logical_line, filename, noqa): """'oslo_' should be used instead of 'oslo.' B317 """ - if pycodestyle.noqa(physical_line): + if noqa: return if re.match(oslo_namespace_imports, logical_line): msg = ("B317: '%s' must be used instead of '%s'.") % ( logical_line.replace('oslo.', 'oslo_'), logical_line) - yield(0, msg) + yield (0, msg) @core.flake8ext @@ -188,4 +187,4 @@ def no_log_warn_check(logical_line): """ msg = ("B320: LOG.warn is deprecated, please use LOG.warning!") if re.match(no_log_warn, logical_line): - yield(0, msg) + yield (0, msg) diff --git a/barbican/plugin/crypto/simple_crypto.py b/barbican/plugin/crypto/simple_crypto.py index 0c06fe076..7c3f8d7cc 100644 --- a/barbican/plugin/crypto/simple_crypto.py +++ b/barbican/plugin/crypto/simple_crypto.py @@ -121,7 +121,7 @@ class SimpleCryptoPlugin(c.CryptoPluginBase): - DSA, without passphrase (supported) - DSA, with passphrase (supported) """ - if(generate_dto.algorithm is None or generate_dto + if (generate_dto.algorithm is None or generate_dto .algorithm.lower() == 'rsa'): private_key = rsa.generate_private_key( public_exponent=65537, diff --git a/barbican/tests/queue/test_retry_scheduler.py b/barbican/tests/queue/test_retry_scheduler.py index 5abf8fe04..f9ef4b89f 100644 --- a/barbican/tests/queue/test_retry_scheduler.py +++ b/barbican/tests/queue/test_retry_scheduler.py @@ -150,7 +150,7 @@ class WhenRunningPeriodicServerRetryLogic(database_utils.RepositoryTestCase): class WhenRunningPeriodicServer(utils.BaseTestCase): - """Tests the timing-related functionality of the periodic task retry server. + """Tests the timing-related functionality of the periodic server. These tests are only concerned with whether or not periodic tasks are actually invoked per configured schedule configuration. The logic of the diff --git a/functionaltests/api/v1/functional/test_secrets.py b/functionaltests/api/v1/functional/test_secrets.py index 3d3e8fe19..07a134664 100644 --- a/functionaltests/api/v1/functional/test_secrets.py +++ b/functionaltests/api/v1/functional/test_secrets.py @@ -1047,7 +1047,7 @@ class SecretsTestCase(base.TestCase): @testcase.attr('negative') def test_secret_create_with_invalid_http_content_type_characters( self, http_content_type): - """Attempt to create secrets with invalid unicode characters in the + """Create secrets with invalid unicode characters in the HTTP request's Content-Type header. Should return a 415. """ @@ -1075,7 +1075,7 @@ class SecretsTestCase(base.TestCase): @testcase.attr('negative') def test_secret_create_with_invalid_payload_content_type_characters( self, payload_content_type): - """Attempt to create secrets with non-ascii characters in the + """Create secrets with non-ascii characters in the payload's content type attribute. Should return a 400. """ @@ -1296,7 +1296,7 @@ class SecretsUnauthedTestCase(base.TestCase): @testcase.attr('negative', 'security') def test_secret_create_unauthed_no_proj_id(self): - """Attempt to create a secret without a token or project id + """Create a secret without a token or project id Should return 401 """ @@ -1307,7 +1307,7 @@ class SecretsUnauthedTestCase(base.TestCase): @testcase.attr('negative', 'security') def test_secret_create_unauthed_fake_proj_id(self): - """Attempt to create a secret with a project id but no token + """Create a secret with a project id but no token Should return 401 """ @@ -1321,7 +1321,7 @@ class SecretsUnauthedTestCase(base.TestCase): @testcase.attr('negative', 'security') def test_secret_create_unauthed_real_proj_id(self): - """Attempt to create a secret with a project id but no token + """Create a secret with a project id but no token Should return 401 """ @@ -1335,7 +1335,7 @@ class SecretsUnauthedTestCase(base.TestCase): @testcase.attr('negative', 'security') def test_secret_get_unauthed_no_proj_id_fake_secret(self): - """Attempt to read a non-existant secret without a token or project id + """Read a non-existant secret without a token or project id Should return 401 """ @@ -1349,7 +1349,7 @@ class SecretsUnauthedTestCase(base.TestCase): @testcase.attr('negative', 'security') def test_secret_get_unauthed_no_proj_id_real_secret(self): - """Attempt to read an existing secret without a token or project id + """Read an existing secret without a token or project id Should return 401 """ @@ -1363,7 +1363,7 @@ class SecretsUnauthedTestCase(base.TestCase): @testcase.attr('negative', 'security') def test_secret_get_unauthed_fake_proj_id_fake_secret(self): - """Attempt to get a non-existant secret with a project id but no token + """Get a non-existant secret with a project id but no token Should return 401 """ @@ -1379,7 +1379,7 @@ class SecretsUnauthedTestCase(base.TestCase): @testcase.attr('negative', 'security') def test_secret_get_unauthed_fake_proj_id_real_secret(self): - """Attempt to get an existing secret with a project id but no token + """Get an existing secret with a project id but no token Should return 401 """ @@ -1395,7 +1395,7 @@ class SecretsUnauthedTestCase(base.TestCase): @testcase.attr('negative', 'security') def test_secret_get_unauthed_real_proj_id_fake_secret(self): - """Attempt to get a non-existant secret with a project id but no token + """Get a non-existant secret with a project id but no token Should return 401 """ @@ -1411,7 +1411,7 @@ class SecretsUnauthedTestCase(base.TestCase): @testcase.attr('negative', 'security') def test_secret_get_unauthed_real_proj_id_real_secret(self): - """Attempt to get an existing secret with a project id but no token + """Get an existing secret with a project id but no token Should return 401 """ @@ -1427,7 +1427,7 @@ class SecretsUnauthedTestCase(base.TestCase): @testcase.attr('negative', 'security') def test_secret_put_unauthed_no_proj_id_fake_secret(self): - """Attempt to update a non-existant secret without a token or project id + """Update a non-existant secret without a token or project id Should return 401 """ @@ -1441,7 +1441,7 @@ class SecretsUnauthedTestCase(base.TestCase): @testcase.attr('negative', 'security') def test_secret_put_unauthed_no_proj_id_real_secret(self): - """Attempt to update an existing secret without a token or project id + """Update an existing secret without a token or project id Should return 401 """ @@ -1455,7 +1455,7 @@ class SecretsUnauthedTestCase(base.TestCase): @testcase.attr('negative', 'security') def test_secret_put_unauthed_fake_proj_id_fake_secret(self): - """Attempt to update a non-existant secret with a project id, but no token + """Update a non-existant secret with a project id, but no token Should return 401 """ @@ -1471,7 +1471,7 @@ class SecretsUnauthedTestCase(base.TestCase): @testcase.attr('negative', 'security') def test_secret_put_unauthed_fake_proj_id_real_secret(self): - """Attempt to update an existing secret with a project id, but no token + """Update an existing secret with a project id, but no token Should return 401 """ @@ -1487,7 +1487,7 @@ class SecretsUnauthedTestCase(base.TestCase): @testcase.attr('negative', 'security') def test_secret_put_unauthed_real_proj_id_fake_secret(self): - """Attempt to update a non-existant secret with a project id, but no token + """Update a non-existant secret with a project id, but no token Should return 401 """ @@ -1503,7 +1503,7 @@ class SecretsUnauthedTestCase(base.TestCase): @testcase.attr('negative', 'security') def test_secret_put_unauthed_real_proj_id_real_secret(self): - """Attempt to update an existing secret with a project id, but no token + """Update an existing secret with a project id, but no token Should return 401 """ @@ -1519,7 +1519,7 @@ class SecretsUnauthedTestCase(base.TestCase): @testcase.attr('negative', 'security') def test_secret_delete_unauthed_no_proj_id_fake_secret(self): - """Attempt to delete a non-existant secret without a token or project id + """Delete a non-existant secret without a token or project id Should return 401 """ @@ -1531,7 +1531,7 @@ class SecretsUnauthedTestCase(base.TestCase): @testcase.attr('negative', 'security') def test_secret_delete_unauthed_no_proj_id_real_secret(self): - """Attempt to delete an existing secret without a token or project id + """Delete an existing secret without a token or project id Should return 401 """ @@ -1543,7 +1543,7 @@ class SecretsUnauthedTestCase(base.TestCase): @testcase.attr('negative', 'security') def test_secret_delete_unauthed_fake_proj_id_fake_secret(self): - """Attempt to delete a non-existant secret with a project id, but no token + """Delete a non-existant secret with a project id, but no token Should return 401 """ @@ -1557,7 +1557,7 @@ class SecretsUnauthedTestCase(base.TestCase): @testcase.attr('negative', 'security') def test_secret_delete_unauthed_fake_proj_id_real_secret(self): - """Attempt to delete an existing secret with a project id, but no token + """Delete an existing secret with a project id, but no token Should return 401 """ @@ -1571,7 +1571,7 @@ class SecretsUnauthedTestCase(base.TestCase): @testcase.attr('negative', 'security') def test_secret_delete_unauthed_real_proj_id_fake_secret(self): - """Attempt to delete a non-existant secret with a project id, but no token + """Delete a non-existant secret with a project id, but no token Should return 401 """ @@ -1585,7 +1585,7 @@ class SecretsUnauthedTestCase(base.TestCase): @testcase.attr('negative', 'security') def test_secret_delete_unauthed_real_proj_id_real_secret(self): - """Attempt to delete an existing secret with a project id, but no token + """Delete an existing secret with a project id, but no token Should return 401 """ diff --git a/requirements.txt b/requirements.txt index fa6bced04..a4213186e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,3 @@ -# The order of packages is significant, because pip processes them in the order -# of appearance. Changing the order has an impact on the overall integration -# process, which may cause wedges in the gate later. alembic>=0.8.10 # MIT cffi>=1.7.0 # MIT cryptography>=2.1 # BSD/Apache-2.0 diff --git a/test-requirements.txt b/test-requirements.txt index 1a40c4f82..4a33d712e 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,9 +1,4 @@ -# The order of packages is significant, because pip processes them in the order -# of appearance. Changing the order has an impact on the overall integration -# process, which may cause wedges in the gate later. - -# hacking should appear first in case something else depends on pep8 -hacking>=3.0.1,<3.1.0 # Apache-2.0 +hacking>=6.1.0,<6.2.0 # Apache-2.0 pyflakes>=2.1.1 coverage!=4.4,>=4.0 # Apache-2.0