Fix PEP8 issues

This commit is contained in:
Ade Lee 2017-08-02 11:41:26 -04:00
parent b48503b71f
commit 6b5629a116
9 changed files with 32 additions and 49 deletions

View File

@ -1,4 +1,4 @@
barbican_tempest_plugin Style Commandments
===============================================
==========================================
Read the OpenStack Style Commandments http://docs.openstack.org/developer/hacking/

View File

@ -1,6 +1,6 @@
===============================================
===============================
Tempest Integration of Novajoin
===============================================
===============================
This directory contains Tempest tests to cover the Novajoin project.

View File

@ -15,4 +15,3 @@ import pbr.version
__version__ = pbr.version.VersionInfo(
'novajoin_tempest_plugin').version_string()

View File

@ -1,15 +0,0 @@
# Copyright 2015
# All Rights Reserved.
#
# 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.

View File

@ -16,11 +16,8 @@
import os
from tempest import config
from tempest.test_discover import plugins
from novajoin_tempest_plugin import config as project_config
class NovajoinTempestPlugin(plugins.TempestPlugin):
def load_tests(self):

View File

@ -393,10 +393,10 @@ class ScenarioTest(tempest.test.BaseTestCase):
network = getattr(net_creds, 'network', None)
addresses = (server['addresses'][network['name']]
if network else [])
for address in addresses:
if (address['version'] == CONF.validation.ip_version_for_ssh
and address['OS-EXT-IPS:type'] == 'fixed'):
return address['addr']
for addr in addresses:
if (addr['version'] == CONF.validation.ip_version_for_ssh and
addr['OS-EXT-IPS:type'] == 'fixed'):
return addr['addr']
raise exceptions.ServerUnreachable(server_id=server['id'])
else:
raise lib_exc.InvalidConfiguration()
@ -453,7 +453,7 @@ class ScenarioTest(tempest.test.BaseTestCase):
sg for sg in list(client.list_security_groups().values())[0]
if sg['tenant_id'] == tenant_id and sg['name'] == 'default'
]
msg = "No default security group for tenant %s." % (tenant_id)
msg = "No default security group for tenant %s." % tenant_id
self.assertGreater(len(sgs), 0, msg)
return sgs[0]

View File

@ -13,11 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import base64
from datetime import datetime
from datetime import timedelta
import os
from oslo_log import log as logging
from tempest import config
@ -45,8 +40,8 @@ class NovajoinScenarioTest(mgr.ScenarioTest):
def setup_clients(cls):
super(NovajoinScenarioTest, cls).setup_clients()
os = getattr(cls, 'os_%s' % cls.credentials[0])
os_adm = getattr(cls, 'os_%s' % cls.credentials[1])
# os = getattr(cls, 'os_%s' % cls.credentials[0])
# os_adm = getattr(cls, 'os_%s' % cls.credentials[1])
# set up ipa client
def verify_host_registered_with_ipa(self, host):
@ -72,7 +67,7 @@ class NovajoinScenarioTest(mgr.ScenarioTest):
# needed for the triple-O tests
pass
def verify_service_deleted(self, servicei, host):
def verify_service_deleted(self, service, host):
# verify service entry does not exist
pass
@ -82,6 +77,6 @@ class NovajoinScenarioTest(mgr.ScenarioTest):
# being tracked
pass
def verify_cert_revoked(self, serial):
# verify that the given certificate has been revoked
pass
def verify_cert_revoked(self, serial):
# verify that the given certificate has been revoked
pass

View File

@ -45,7 +45,7 @@ class EnrollmentTest(novajoin_manager.NovajoinScenarioTest):
* Add metadata to register and create some cert entries
* Validate that the certs for those entries are issued and
tracked
* Validate that the service entries arer removed when the
* Validate that the service entries are removed when the
instance is deleted.
* Validate that the certs issued have been revoked.
"""
@ -63,6 +63,9 @@ class EnrollmentTest(novajoin_manager.NovajoinScenarioTest):
security_group = self._create_security_group()
# TODO(alee) Add metadata for ipa_enroll=True
# TODO(alee) Add metadata for service to be created/joined
service = "random service to be added"
cn = "cn of random service certificate"
server = self.create_server(
name='passed_metadata_server',
image_id=self.no_metadata_img_uuid,
@ -72,6 +75,8 @@ class EnrollmentTest(novajoin_manager.NovajoinScenarioTest):
)
self.verify_registered_host(server, keypair, service, cn)
self.delete_server(server)
serial = "serial number of random service certificate"
self.verify_unregistered_host(server, service, serial)
@decorators.idempotent_id('cbc752ed-b716-4727-910f-956ccf965723')
@ -80,27 +85,32 @@ class EnrollmentTest(novajoin_manager.NovajoinScenarioTest):
LOG.info("Creating keypair and security group")
keypair = self.create_keypair()
security_group = self._create_security_group()
# TODO(alee) Add metadata for service to be created/joined
service = "random service to be added"
cn = "cn of random service certificate"
server = self.create_server(
name='signed_img_server',
image_id=metadata_img_uuid,
name='img_with_metadata_server',
image_id=self.metadata_img_uuid,
key_name=keypair['name'],
security_groups=[{'name': security_group['name']}],
wait_until='ACTIVE'
)
self.verify_registered_host(server, keypair, service, cn)
self.delete_server(server)
serial = "serial number of cert for random service"
self.verify_unregistered_host(server, service, serial)
def verify_registered_host(self, server, keypair, service, cn):
self.verify_host_registered_with_ipa(server)
self.verify_host_has_keytab(server)
self.verify_host_is_ipaclient(server)
self.verify_host_is_ipaclient(server, keypair)
self.verify_service_created(service, server)
self.verify_cert_tracked(self, host, keypair, cn)
self.verify_cert_tracked(server, keypair, cn)
def verify_unregistered_host(self, server, service, serial):
self.verify_host_not_registered_with_ipa(server)
self.verify_service_deleted(service, server)
self.verify_cert_revoked(serial)

View File

@ -12,12 +12,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from novajoin_tempest_plugin.tests.scenario import novajoin_manager
from oslo_log import log as logging
from tempest import config
from tempest.lib import decorators
from tempest import test
from novajoin_tempest_plugin.tests.scenario import novajoin_manager
CONF = config.CONF
LOG = logging.getLogger(__name__)