diff options
author | Jenkins <jenkins@review.openstack.org> | 2017-05-05 19:15:17 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2017-05-05 19:15:17 +0000 |
commit | 28794ed6ca441b9b8ed56e80a5d92feba381ef05 (patch) | |
tree | 91f58910557967465c5445ea87a97611ad9f49d6 | |
parent | c7501417a0d0f1f46f90c2f4c6d9b1e38bd4d96f (diff) | |
parent | 8860c161da8ffc05723005189447507d04551860 (diff) | |
download | python-barbicanclient-28794ed6ca441b9b8ed56e80a5d92feba381ef05.tar.gz |
Merge "Extend pep8 test coverage"
-rw-r--r-- | functionaltests/cli/base.py | 1 | ||||
-rw-r--r-- | functionaltests/cli/v1/behaviors/base_behaviors.py | 3 | ||||
-rw-r--r-- | functionaltests/cli/v1/behaviors/container_behaviors.py | 1 | ||||
-rw-r--r-- | functionaltests/cli/v1/smoke/test_acl.py | 3 | ||||
-rw-r--r-- | functionaltests/cli/v1/smoke/test_secret.py | 2 | ||||
-rw-r--r-- | functionaltests/client/base.py | 3 | ||||
-rw-r--r-- | functionaltests/client/test_client_connectivity.py | 36 | ||||
-rw-r--r-- | functionaltests/client/v1/functional/test_acl.py | 7 | ||||
-rw-r--r-- | functionaltests/client/v1/functional/test_containers.py | 4 | ||||
-rw-r--r-- | functionaltests/client/v1/functional/test_orders.py | 4 | ||||
-rw-r--r-- | functionaltests/client/v1/functional/test_secrets.py | 3 | ||||
-rw-r--r-- | functionaltests/client/v1/smoke/test_containers.py | 4 | ||||
-rw-r--r-- | functionaltests/client/v1/smoke/test_orders.py | 2 | ||||
-rw-r--r-- | functionaltests/client/v1/smoke/test_secrets.py | 3 | ||||
-rw-r--r-- | functionaltests/common/cleanup.py | 15 | ||||
-rwxr-xr-x | tools/hacking.sh | 3 | ||||
-rw-r--r-- | tox.ini | 2 |
17 files changed, 41 insertions, 55 deletions
diff --git a/functionaltests/cli/base.py b/functionaltests/cli/base.py index 23fcff5..77d0baf 100644 --- a/functionaltests/cli/base.py +++ b/functionaltests/cli/base.py @@ -16,6 +16,7 @@ limitations under the License. from functionaltests.base import BaseTestCase + class CmdLineTestCase(BaseTestCase): def setUp(self): diff --git a/functionaltests/cli/v1/behaviors/base_behaviors.py b/functionaltests/cli/v1/behaviors/base_behaviors.py index 8c1dac5..a3da5ae 100644 --- a/functionaltests/cli/v1/behaviors/base_behaviors.py +++ b/functionaltests/cli/v1/behaviors/base_behaviors.py @@ -49,7 +49,8 @@ class BaseBehaviors(object): if 'v3' in CONF.identity.auth_version.lower(): arg_list.extend(['--os-auth-url', CONF.identity.uri_v3]) - arg_list.extend(['--os-project-name', CONF.keymanager.project_name]) + arg_list.extend(['--os-project-name', + CONF.keymanager.project_name]) # NOTE(jaosorior): Should we add the user_domain_name to the # config? arg_list.extend( diff --git a/functionaltests/cli/v1/behaviors/container_behaviors.py b/functionaltests/cli/v1/behaviors/container_behaviors.py index 8e99520..d487eda 100644 --- a/functionaltests/cli/v1/behaviors/container_behaviors.py +++ b/functionaltests/cli/v1/behaviors/container_behaviors.py @@ -40,6 +40,7 @@ class ContainerBehaviors(base_behaviors.BaseBehaviors): def create_container(self, secret_hrefs=[]): """Create a container + :param secret_hrefs A list of existing secrets :return: the href to the newly created container diff --git a/functionaltests/cli/v1/smoke/test_acl.py b/functionaltests/cli/v1/smoke/test_acl.py index a1ae6f8..cae2c4e 100644 --- a/functionaltests/cli/v1/smoke/test_acl.py +++ b/functionaltests/cli/v1/smoke/test_acl.py @@ -13,11 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -from functionaltests import utils from functionaltests.cli.base import CmdLineTestCase from functionaltests.cli.v1.behaviors import acl_behaviors from functionaltests.cli.v1.behaviors import container_behaviors from functionaltests.cli.v1.behaviors import secret_behaviors +from functionaltests import utils from testtools import testcase ARGS_TYPE = {'short_arg_false': [False], @@ -238,4 +238,3 @@ class ACLTestCase(CmdLineTestCase): err = self.acl_behaviors.acl_delete(entity_ref=secret_ref + '/acl') # above secret ACL ref is passed instead of expected secret_ref self.assertIn('Secret ACL URI', err) - diff --git a/functionaltests/cli/v1/smoke/test_secret.py b/functionaltests/cli/v1/smoke/test_secret.py index a9da6b6..ed0882b 100644 --- a/functionaltests/cli/v1/smoke/test_secret.py +++ b/functionaltests/cli/v1/smoke/test_secret.py @@ -13,8 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import base64 - from functionaltests.cli.base import CmdLineTestCase from functionaltests.cli.v1.behaviors.secret_behaviors import SecretBehaviors from functionaltests.common import keys diff --git a/functionaltests/client/base.py b/functionaltests/client/base.py index f408f1f..2664b15 100644 --- a/functionaltests/client/base.py +++ b/functionaltests/client/base.py @@ -13,11 +13,10 @@ 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 +from barbicanclient import client from functionaltests.base import BaseTestCase from functionaltests.common import config -from barbicanclient import client from keystoneauth1 import identity from keystoneauth1 import session diff --git a/functionaltests/client/test_client_connectivity.py b/functionaltests/client/test_client_connectivity.py index a734342..a3c01bb 100644 --- a/functionaltests/client/test_client_connectivity.py +++ b/functionaltests/client/test_client_connectivity.py @@ -12,15 +12,14 @@ # implied. # See the License for the specific language governing permissions and # limitations under the License. -import logging -from functionaltests.base import BaseTestCase -from functionaltests.common import config from barbicanclient import client from barbicanclient import exceptions +from functionaltests.base import BaseTestCase +from functionaltests.common import config +from keystoneauth1 import exceptions as ks_exceptions from keystoneauth1 import identity from keystoneauth1 import session -from keystoneauth1 import exceptions as ks_exceptions CONF = config.get_config() @@ -108,8 +107,7 @@ class WhenTestingClientConnectivity(BaseTestCase): auth=self.auth, interface=client._DEFAULT_SERVICE_INTERFACE, service_type=client._DEFAULT_SERVICE_TYPE, - version=client._DEFAULT_API_VERSION, - ) + version=client._DEFAULT_API_VERSION) self.assert_client_can_contact_barbican(barbicanclient) @@ -119,8 +117,7 @@ class WhenTestingClientConnectivity(BaseTestCase): auth=self.auth, interface=client._DEFAULT_SERVICE_INTERFACE, service_type='wrong-service-type', - version=client._DEFAULT_API_VERSION, - ) + version=client._DEFAULT_API_VERSION) self.assert_client_cannot_get_endpoint(barbicanclient) @@ -129,8 +126,7 @@ class WhenTestingClientConnectivity(BaseTestCase): auth=self.auth, interface='wrong-interface', service_type=client._DEFAULT_SERVICE_TYPE, - version=client._DEFAULT_API_VERSION, - ) + version=client._DEFAULT_API_VERSION) self.assert_client_cannot_get_endpoint(barbicanclient) @@ -140,8 +136,7 @@ class WhenTestingClientConnectivity(BaseTestCase): interface=client._DEFAULT_SERVICE_INTERFACE, service_type=client._DEFAULT_SERVICE_TYPE, service_name='wrong-service-name', - version=client._DEFAULT_API_VERSION, - ) + version=client._DEFAULT_API_VERSION) self.assert_client_cannot_get_endpoint(barbicanclient) @@ -151,27 +146,24 @@ class WhenTestingClientConnectivity(BaseTestCase): interface=client._DEFAULT_SERVICE_INTERFACE, service_type=client._DEFAULT_SERVICE_TYPE, region_name='wrong-region-name', - version=client._DEFAULT_API_VERSION, - ) + version=client._DEFAULT_API_VERSION) self.assert_client_cannot_get_endpoint(barbicanclient) - def test_client_cannot_access_server_if_nonexistent_version_specified(self): - barbicanclient = client.Client( + def test_client_cannot_access_server_if_nonexistent_version_specified(self): # noqa + barbicanclient_1 = client.Client( project_id=CONF.keymanager.project_id, auth=self.auth, interface=client._DEFAULT_SERVICE_INTERFACE, service_type=client._DEFAULT_SERVICE_TYPE, - version='wrong-version', - ) + version='wrong-version') - self.assertRaises(TypeError, barbicanclient.containers.list) + self.assertRaises(TypeError, barbicanclient_1.containers.list) - def test_client_cannot_access_server_if_nonexistent_version_specified(self): - barbicanclient = client.Client( + barbicanclient_2 = client.Client( endpoint=CONF.keymanager.url, project_id=CONF.keymanager.project_id, auth=self.auth, version='nonexistent_version') - self.assert_client_cannot_contact_barbican(barbicanclient) + self.assert_client_cannot_contact_barbican(barbicanclient_2) diff --git a/functionaltests/client/v1/functional/test_acl.py b/functionaltests/client/v1/functional/test_acl.py index c7cad7d..61de646 100644 --- a/functionaltests/client/v1/functional/test_acl.py +++ b/functionaltests/client/v1/functional/test_acl.py @@ -14,9 +14,9 @@ # limitations under the License. from testtools import testcase -from functionaltests import utils from functionaltests.client import base from functionaltests.common import cleanup +from functionaltests import utils from oslo_utils import uuidutils from barbicanclient import exceptions @@ -332,10 +332,7 @@ class ACLsTestCase(BaseACLsTestCase): def test_acl_incorrect_submit(self, users, project_access, entity_ref_method, acl_type, expect_users, expect_project_access, **kwargs): - """Incorrect Submit operation on ACL entity which stores ACL setting in - Barbican. - - """ + """Check incorrect submit operation failure on ACL entity.""" entity_ref, _ = getattr(self, entity_ref_method)() acl_data = {'entity_ref': entity_ref, 'users': users, diff --git a/functionaltests/client/v1/functional/test_containers.py b/functionaltests/client/v1/functional/test_containers.py index 294e99a..e632b23 100644 --- a/functionaltests/client/v1/functional/test_containers.py +++ b/functionaltests/client/v1/functional/test_containers.py @@ -12,10 +12,10 @@ # implied. # See the License for the specific language governing permissions and # limitations under the License. -from testtools import testcase -from functionaltests import utils from functionaltests.client import base from functionaltests.common import cleanup +from functionaltests import utils +from testtools import testcase from barbicanclient import exceptions diff --git a/functionaltests/client/v1/functional/test_orders.py b/functionaltests/client/v1/functional/test_orders.py index f15d7cf..4dc2444 100644 --- a/functionaltests/client/v1/functional/test_orders.py +++ b/functionaltests/client/v1/functional/test_orders.py @@ -15,11 +15,11 @@ import pytz import sys -from testtools import testcase -from functionaltests import utils from functionaltests.client import base from functionaltests.common import cleanup +from functionaltests import utils from oslo_utils import timeutils +from testtools import testcase from barbicanclient import exceptions diff --git a/functionaltests/client/v1/functional/test_secrets.py b/functionaltests/client/v1/functional/test_secrets.py index d2a2c87..0c8abed 100644 --- a/functionaltests/client/v1/functional/test_secrets.py +++ b/functionaltests/client/v1/functional/test_secrets.py @@ -604,7 +604,8 @@ class SecretsTestCase(base.TestCase): """Covers creating secrets with various invalid payloads. These requests will fail with a value error before the request to the - server is made""" + server is made + """ secret = self.barbicanclient.secrets.create( **secret_create_defaults_data) secret.payload = payload diff --git a/functionaltests/client/v1/smoke/test_containers.py b/functionaltests/client/v1/smoke/test_containers.py index b25d700..2c67bca 100644 --- a/functionaltests/client/v1/smoke/test_containers.py +++ b/functionaltests/client/v1/smoke/test_containers.py @@ -12,10 +12,10 @@ # implied. # See the License for the specific language governing permissions and # limitations under the License. -from testtools import testcase -from functionaltests import utils from functionaltests.client import base from functionaltests.common import cleanup +from functionaltests import utils +from testtools import testcase create_secret_defaults_data = { diff --git a/functionaltests/client/v1/smoke/test_orders.py b/functionaltests/client/v1/smoke/test_orders.py index e99c777..d0370a0 100644 --- a/functionaltests/client/v1/smoke/test_orders.py +++ b/functionaltests/client/v1/smoke/test_orders.py @@ -14,9 +14,9 @@ # limitations under the License. from testtools import testcase -from functionaltests import utils from functionaltests.client import base from functionaltests.common import cleanup +from functionaltests import utils order_create_key_data = { diff --git a/functionaltests/client/v1/smoke/test_secrets.py b/functionaltests/client/v1/smoke/test_secrets.py index e57bfc9..5482582 100644 --- a/functionaltests/client/v1/smoke/test_secrets.py +++ b/functionaltests/client/v1/smoke/test_secrets.py @@ -12,13 +12,12 @@ # implied. # See the License for the specific language governing permissions and # limitations under the License. -import base64 -from testtools import testcase from functionaltests.client import base from functionaltests.common import cleanup from functionaltests.common import keys from functionaltests import utils +from testtools import testcase secret_create_defaults_data = { "name": "AES key", diff --git a/functionaltests/common/cleanup.py b/functionaltests/common/cleanup.py index 6208304..031ed58 100644 --- a/functionaltests/common/cleanup.py +++ b/functionaltests/common/cleanup.py @@ -28,17 +28,19 @@ class CleanUp(object): self.barbicanclient = barbicanclient def delete_all_entities(self): - """Helper method to delete all containers and secrets used for - testing""" + """Helper method to delete all entities used for testing""" self._delete_all_acls() self._delete_all_containers() self._delete_all_orders() self._delete_all_secrets() def add_entity(self, entity): - """Stores an entity in Barbican to be used for testing - and keeps track of entity for removal after tests are - run""" + """Stores an entity in Barbican + + used for testing and keeps track of entity for removal after + tests are running + + """ entity_type = str(type(entity)).lower() if 'acl' in entity_type: entity_ref = entity.submit() @@ -57,8 +59,7 @@ class CleanUp(object): return entity_ref def _delete_all_containers(self): - """Helper method to delete all containers used for - testing""" + """Helper method to delete all containers used for testing""" for container_ref in self.created_entities['container']: self.barbicanclient.containers.delete(container_ref) diff --git a/tools/hacking.sh b/tools/hacking.sh deleted file mode 100755 index 967902b..0000000 --- a/tools/hacking.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -flake8 barbicanclient | tee flake8.log -exit ${PIPESTATUS[0]} @@ -19,7 +19,7 @@ commands = commands = oslo_debug_helper -t barbicanclient/tests {posargs} [testenv:pep8] -commands = {toxinidir}/tools/hacking.sh {posargs} +commands = flake8 {posargs} [testenv:venv] commands = {posargs} |