Merge "Skip some tests for vault plugin"
This commit is contained in:
commit
fbff8cdfc3
@ -610,20 +610,6 @@ def get_tomorrow_timestamp():
|
||||
return tomorrow.isoformat()
|
||||
|
||||
|
||||
def string_to_datetime(datetimestring, date_formats=None):
|
||||
date_formats = date_formats or [
|
||||
'%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M:%S.%f', '%Y-%m-%dT%H:%M:%S.%fZ',
|
||||
'%Y-%m-%dT%H:%M:%S.%f', "%Y-%m-%dT%H:%M:%SZ", "%Y-%m-%dT%H:%M:%S"]
|
||||
|
||||
for dateformat in date_formats:
|
||||
try:
|
||||
return datetime.datetime.strptime(datetimestring, dateformat)
|
||||
except ValueError:
|
||||
continue
|
||||
else:
|
||||
raise
|
||||
|
||||
|
||||
def get_id_from_ref(ref):
|
||||
"""Returns id from reference."""
|
||||
ref_id = None
|
||||
@ -676,5 +662,9 @@ def is_kmip_enabled():
|
||||
return os.environ.get('KMIP_PLUGIN_ENABLED') is not None
|
||||
|
||||
|
||||
def is_vault_enabled():
|
||||
return os.environ.get('VAULT_PLUGIN_ENABLED') is not None
|
||||
|
||||
|
||||
class DummyClassForTesting(object):
|
||||
pass
|
||||
|
@ -16,6 +16,7 @@ from oslo_serialization import jsonutils
|
||||
import sys
|
||||
import time
|
||||
|
||||
import testtools
|
||||
from testtools import testcase
|
||||
|
||||
from barbican.tests import utils
|
||||
@ -567,6 +568,8 @@ class OrdersTestCase(base.TestCase):
|
||||
self.assertRegex(order_resp.model.order_ref, regex)
|
||||
|
||||
@testcase.attr('positive')
|
||||
@testtools.skipIf(utils.is_vault_enabled(),
|
||||
"Vault does not support this operation")
|
||||
def test_encryption_using_generated_key(self):
|
||||
"""Tests functionality of a generated asymmetric key pair."""
|
||||
test_model = order_models.OrderModel(**self.asymmetric_data)
|
||||
|
@ -236,6 +236,8 @@ class RSATestCase(base.TestCase):
|
||||
self.verify_container_keys_equal(secrets, with_passphrase=True)
|
||||
|
||||
@testcase.attr('positive')
|
||||
@testtools.skipIf(utils.is_vault_enabled(),
|
||||
"Vault does not support this operation")
|
||||
def test_rsa_order_container(self):
|
||||
"""Post an order for a container"""
|
||||
order_ref = self.order_container()
|
||||
@ -244,7 +246,7 @@ class RSATestCase(base.TestCase):
|
||||
self.verify_container_keys_valid(secrets)
|
||||
|
||||
@testcase.attr('positive')
|
||||
@testtools.skipIf(utils.is_kmip_enabled(),
|
||||
@testtools.skipIf(utils.is_kmip_enabled() or utils.is_vault_enabled(),
|
||||
"PyKMIP does not support this operation")
|
||||
def test_rsa_order_container_with_passphrase(self):
|
||||
"""Post an order for a container with a passphrase"""
|
||||
@ -265,6 +267,8 @@ class RSATestCase(base.TestCase):
|
||||
self.verify_container_keys_equal(secrets)
|
||||
|
||||
@testcase.attr('positive')
|
||||
@testtools.skipIf(utils.is_vault_enabled(),
|
||||
"Vault does not support this operation")
|
||||
def test_rsa_order_certificate_from_ordered_container(self):
|
||||
"""Post an order for a certificate"""
|
||||
order_ref = self.order_container()
|
||||
@ -276,7 +280,7 @@ class RSATestCase(base.TestCase):
|
||||
self.verify_certificate_order_status(order_status)
|
||||
|
||||
@testcase.attr('positive')
|
||||
@testtools.skipIf(utils.is_kmip_enabled(),
|
||||
@testtools.skipIf(utils.is_kmip_enabled() or utils.is_vault_enabled(),
|
||||
"PyKMIP does not support this operation")
|
||||
def test_rsa_order_certificate_from_ordered_container_with_pass(self):
|
||||
"""Post an order for a certificate"""
|
||||
|
@ -26,6 +26,8 @@ plugin=$1
|
||||
|
||||
if [[ "$plugin" == "kmip" ]]; then
|
||||
export KMIP_PLUGIN_ENABLED=1
|
||||
elif [[ "$plugin" == "vault" ]]; then
|
||||
export VAULT_PLUGIN_ENABLED=1
|
||||
fi
|
||||
|
||||
# run the tests sequentially
|
||||
|
2
tox.ini
2
tox.ini
@ -114,6 +114,7 @@ commands =
|
||||
coverage html -d cover
|
||||
coverage xml -o cover/coverage.xml
|
||||
passenv = KMIP_PLUGIN_ENABLED
|
||||
VAULT_PLUGIN_ENABLED
|
||||
|
||||
[testenv:py35functional]
|
||||
basepython = python3
|
||||
@ -127,6 +128,7 @@ commands =
|
||||
coverage html -d cover
|
||||
coverage xml -o cover/coverage.xml
|
||||
passenv = KMIP_PLUGIN_ENABLED
|
||||
VAULT_PLUGIN_ENABLED
|
||||
|
||||
[testenv:cmd]
|
||||
basepython = python3
|
||||
|
Loading…
x
Reference in New Issue
Block a user