Merge "Extend pep8 test coverage"
This commit is contained in:
commit
28794ed6ca
|
@ -16,6 +16,7 @@ limitations under the License.
|
|||
|
||||
from functionaltests.base import BaseTestCase
|
||||
|
||||
|
||||
class CmdLineTestCase(BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
#!/bin/bash
|
||||
flake8 barbicanclient | tee flake8.log
|
||||
exit ${PIPESTATUS[0]}
|
Loading…
Reference in New Issue