Move to oslotest

Start using oslotest, it's not a complete migration from
testtools, but it covers most occurances.

Change-Id: I74b675a08e9a08690245d75cfbe3cc491775588f
This commit is contained in:
Steve Martinelli 2014-08-25 14:42:18 -04:00
parent 6ebb6b72df
commit ea6fa97546
20 changed files with 70 additions and 64 deletions

View File

@ -26,7 +26,6 @@ import urllib
import mock
import pecan
import testtools
import webtest
from barbican import api
@ -38,6 +37,7 @@ from barbican.common import validators
import barbican.context
from barbican.model import models
from barbican.openstack.common import timeutils
from barbican.tests import utils
LOG = logging.getLogger(__name__)
@ -119,7 +119,7 @@ def create_consumer(container_id, id_ref):
return consumer
class SecretAllowAllMimeTypesDecoratorTest(testtools.TestCase):
class SecretAllowAllMimeTypesDecoratorTest(utils.BaseTestCase):
def setUp(self):
super(SecretAllowAllMimeTypesDecoratorTest, self).setUp()
@ -150,7 +150,7 @@ class SecretAllowAllMimeTypesDecoratorTest(testtools.TestCase):
self._empty_function)
class FunctionalTest(testtools.TestCase):
class FunctionalTest(utils.BaseTestCase):
def setUp(self):
super(FunctionalTest, self).setUp()
@ -1716,8 +1716,8 @@ class WhenCreatingTypeOrdersUsingOrdersResource(FunctionalTest):
self.queue_resource = mock.MagicMock()
self.queue_resource.process_type_order.return_value = None
@testtools.skip("atiwari: remove skip once CR 111412 merged")
def test_should_add_new_order(self):
self.skipTest("atiwari: remove skip once CR 111412 merged")
resp = self.app.post_json(
'/orders/', self.order_req
)
@ -1745,7 +1745,7 @@ class WhenCreatingTypeOrdersUsingOrdersResource(FunctionalTest):
self.assertEqual(resp.status_int, 415)
class WhenAddingNavigationHrefs(testtools.TestCase):
class WhenAddingNavigationHrefs(utils.BaseTestCase):
def setUp(self):
super(WhenAddingNavigationHrefs, self).setUp()
@ -1786,7 +1786,7 @@ class WhenAddingNavigationHrefs(testtools.TestCase):
self.assertNotIn('next', data_with_hrefs)
class TestingJsonSanitization(testtools.TestCase):
class TestingJsonSanitization(utils.BaseTestCase):
def test_json_sanitization_without_array(self):
json_without_array = {"name": "name", "algorithm": "AES",

View File

@ -23,7 +23,6 @@ import os
import mock
from oslo.config import cfg
import testtools
from webob import exc
from barbican.api.controllers import consumers
@ -32,6 +31,7 @@ from barbican.api.controllers import secrets
from barbican.api.controllers import versions
from barbican import context
from barbican.openstack.common import policy
from barbican.tests import utils
CONF = cfg.CONF
@ -97,7 +97,7 @@ class ConsumerResource(TestableResource):
controller_cls = consumers.ContainerConsumerController
class BaseTestCase(testtools.TestCase):
class BaseTestCase(utils.BaseTestCase):
def setUp(self):
super(BaseTestCase, self).setUp()

View File

@ -20,7 +20,6 @@ transport key resource classes.
import mock
import pecan
import testtools
import webtest
from barbican.api import app
@ -28,6 +27,7 @@ from barbican.api import controllers
from barbican.common import exception as excep
import barbican.context
from barbican.model import models
from barbican.tests import utils
def get_barbican_env(keystone_id):
@ -79,7 +79,7 @@ def create_transport_key(id_ref="id",
return tkey
class FunctionalTest(testtools.TestCase):
class FunctionalTest(utils.BaseTestCase):
def setUp(self):
super(FunctionalTest, self).setUp()

View File

@ -13,12 +13,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
import testtools
from barbican.common import utils
from barbican.tests import utils as test_utils
class WhenTestingHostnameForRefsGetter(testtools.TestCase):
class WhenTestingHostnameForRefsGetter(test_utils.BaseTestCase):
def setUp(self):
super(WhenTestingHostnameForRefsGetter, self).setUp()
@ -50,7 +50,7 @@ class WhenTestingHostnameForRefsGetter(testtools.TestCase):
self.version))
class WhenTestingAcceptEncodingGetter(testtools.TestCase):
class WhenTestingAcceptEncodingGetter(test_utils.BaseTestCase):
def setUp(self):
super(WhenTestingAcceptEncodingGetter, self).setUp()
@ -109,7 +109,7 @@ class WhenTestingAcceptEncodingGetter(testtools.TestCase):
self.assertEqual("mock.Mock", fullname)
class WhenTestingGenerateFullClassnameForInstance(testtools.TestCase):
class WhenTestingGenerateFullClassnameForInstance(test_utils.BaseTestCase):
def setUp(self):
super(WhenTestingGenerateFullClassnameForInstance, self).setUp()

View File

@ -16,10 +16,9 @@
import datetime
import unittest
import testtools
from barbican.common import exception as excep
from barbican.common import validators
from barbican.tests import utils
def suite():
@ -30,7 +29,7 @@ def suite():
return suite
class WhenTestingValidatorsFunctions(testtools.TestCase):
class WhenTestingValidatorsFunctions(utils.BaseTestCase):
def test_secret_too_big_is_false_for_small_secrets(self):
data = b'\xb0'
@ -57,7 +56,7 @@ class WhenTestingValidatorsFunctions(testtools.TestCase):
self.assertTrue(is_too_big)
class WhenTestingSecretValidator(testtools.TestCase):
class WhenTestingSecretValidator(utils.BaseTestCase):
def setUp(self):
super(WhenTestingSecretValidator, self).setUp()
@ -309,7 +308,7 @@ class WhenTestingSecretValidator(testtools.TestCase):
self.validator.validate(self.secret_req)
class WhenTestingOrderValidator(testtools.TestCase):
class WhenTestingOrderValidator(utils.BaseTestCase):
def setUp(self):
super(WhenTestingOrderValidator, self).setUp()
@ -544,7 +543,7 @@ class WhenTestingOrderValidator(testtools.TestCase):
)
class WhenTestingContainerValidator(testtools.TestCase):
class WhenTestingContainerValidator(utils.BaseTestCase):
def setUp(self):
super(WhenTestingContainerValidator, self).setUp()
@ -740,7 +739,7 @@ class WhenTestingContainerValidator(testtools.TestCase):
self.assertEqual('secret_refs', exception.invalid_property)
class WhenTestingRSAContainerValidator(testtools.TestCase):
class WhenTestingRSAContainerValidator(utils.BaseTestCase):
def setUp(self):
super(WhenTestingRSAContainerValidator, self).setUp()
@ -853,7 +852,7 @@ class WhenTestingRSAContainerValidator(testtools.TestCase):
self.assertEqual('secret_refs', exception.invalid_property)
class WhenTestingCertificateContainerValidator(testtools.TestCase):
class WhenTestingCertificateContainerValidator(utils.BaseTestCase):
def setUp(self):
super(WhenTestingCertificateContainerValidator, self).setUp()
@ -932,7 +931,7 @@ class WhenTestingCertificateContainerValidator(testtools.TestCase):
self.assertEqual('secret_refs', exception.invalid_property)
class WhenTestingTransportKeyValidator(testtools.TestCase):
class WhenTestingTransportKeyValidator(utils.BaseTestCase):
def setUp(self):
super(WhenTestingTransportKeyValidator, self).setUp()
@ -963,7 +962,7 @@ class WhenTestingTransportKeyValidator(testtools.TestCase):
self.assertEqual('transport_key', exception.invalid_property)
class WhenTestingConsumerValidator(testtools.TestCase):
class WhenTestingConsumerValidator(utils.BaseTestCase):
def setUp(self):
super(WhenTestingConsumerValidator, self).setUp()
@ -1006,7 +1005,7 @@ class WhenTestingConsumerValidator(testtools.TestCase):
self.validator.validate(self.consumer_req)
class WhenTestingTypeOrderValidator(testtools.TestCase):
class WhenTestingTypeOrderValidator(utils.BaseTestCase):
def setUp(self):
super(WhenTestingTypeOrderValidator, self).setUp()

View File

@ -15,12 +15,11 @@
import datetime
import testtools
from barbican.model import models
from barbican.tests import utils
class WhenCreatingNewSecret(testtools.TestCase):
class WhenCreatingNewSecret(utils.BaseTestCase):
def setUp(self):
super(WhenCreatingNewSecret, self).setUp()
self.parsed_secret = {'name': 'name',
@ -42,7 +41,7 @@ class WhenCreatingNewSecret(testtools.TestCase):
self.assertIsInstance(secret.expiration, datetime.datetime)
class WhenCreatingNewContainer(testtools.TestCase):
class WhenCreatingNewContainer(utils.BaseTestCase):
def setUp(self):
super(WhenCreatingNewContainer, self).setUp()
self.parsed_container = {'name': 'name',
@ -113,7 +112,7 @@ class WhenCreatingNewContainer(testtools.TestCase):
self.assertEqual(container.container_secrets[0].secret_id, '123456')
class WhenCreatingNewConsumer(testtools.TestCase):
class WhenCreatingNewConsumer(utils.BaseTestCase):
def setUp(self):
super(WhenCreatingNewConsumer, self).setUp()
self.parsed_consumer = {'name': 'name',
@ -139,7 +138,7 @@ class WhenCreatingNewConsumer(testtools.TestCase):
self.assertNotEqual(consumer_one.data_hash, consumer_three.data_hash)
class WhenProcessingJsonBlob(testtools.TestCase):
class WhenProcessingJsonBlob(utils.BaseTestCase):
def setUp(self):
super(WhenProcessingJsonBlob, self).setUp()
self.json_blob = models.JsonBlob()

View File

@ -14,13 +14,13 @@
import mock
from oslo.config import cfg
import sqlalchemy.orm as sa_orm
import testtools
from barbican.common import exception
from barbican.model import repositories
from barbican.tests import utils
class WhenCleaningRepositoryPagingParameters(testtools.TestCase):
class WhenCleaningRepositoryPagingParameters(utils.BaseTestCase):
def setUp(self):
super(WhenCleaningRepositoryPagingParameters, self).setUp()

View File

@ -21,11 +21,11 @@ from Crypto.Util import asn1
from cryptography import fernet
import mock
import six
import testtools
from barbican.model import models
from barbican.plugin.crypto import crypto as plugin
from barbican.plugin.crypto import simple_crypto as simple
from barbican.tests import utils
class TestCryptoPlugin(plugin.CryptoPluginBase):
@ -68,7 +68,7 @@ class TestCryptoPlugin(plugin.CryptoPluginBase):
return False
class WhenTestingSimpleCryptoPlugin(testtools.TestCase):
class WhenTestingSimpleCryptoPlugin(utils.BaseTestCase):
def setUp(self):
super(WhenTestingSimpleCryptoPlugin, self).setUp()

View File

@ -14,14 +14,14 @@
# limitations under the License.
import mock
import testtools
from barbican.model import models
from barbican.plugin.crypto import crypto as plugin_import
from barbican.plugin.crypto import p11_crypto
from barbican.tests import utils
class WhenTestingP11CryptoPlugin(testtools.TestCase):
class WhenTestingP11CryptoPlugin(utils.BaseTestCase):
def setUp(self):
super(WhenTestingP11CryptoPlugin, self).setUp()

View File

@ -14,9 +14,9 @@
# limitations under the License.
import mock
import testtools
from barbican.plugin.interface import secret_store as str
from barbican.tests import utils
class TestSecretStore(str.SecretStoreBase):
@ -86,7 +86,7 @@ class TestSecretStoreWithTransportKey(str.SecretStoreBase):
return True
class WhenTestingSecretStorePluginManager(testtools.TestCase):
class WhenTestingSecretStorePluginManager(utils.BaseTestCase):
def setUp(self):
super(WhenTestingSecretStorePluginManager, self).setUp()

View File

@ -20,6 +20,8 @@ import mock
from requests import exceptions as request_exceptions
import testtools
from barbican.tests import utils
try:
import barbican.plugin.dogtag as dogtag_import
import barbican.plugin.interface.certificate_manager as cm
@ -34,7 +36,7 @@ except ImportError:
@testtools.skipIf(not imports_ok, "Dogtag imports not available")
class WhenTestingDogtagKRAPlugin(testtools.TestCase):
class WhenTestingDogtagKRAPlugin(utils.BaseTestCase):
def setUp(self):
super(WhenTestingDogtagKRAPlugin, self).setUp()
@ -187,7 +189,7 @@ class WhenTestingDogtagKRAPlugin(testtools.TestCase):
@testtools.skipIf(not imports_ok, "Dogtag imports not available")
class WhenTestingDogtagCAPlugin(testtools.TestCase):
class WhenTestingDogtagCAPlugin(utils.BaseTestCase):
def setUp(self):
super(WhenTestingDogtagCAPlugin, self).setUp()

View File

@ -17,6 +17,7 @@ import mock
import testtools
from barbican.plugin.interface import secret_store
from barbican.tests import utils
try:
from kmip.core import attributes as attr
@ -36,7 +37,7 @@ except ImportError:
@testtools.skipIf(not kmip_available, "KMIP imports not available")
class WhenTestingKMIPSecretStore(testtools.TestCase):
class WhenTestingKMIPSecretStore(utils.BaseTestCase):
"""Test using the KMIP server backend for SecretStore."""
def setUp(self):

View File

@ -12,15 +12,16 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import testtools
import mock
import barbican.model.repositories as repo
from barbican.plugin.interface import secret_store
from barbican.plugin import store_crypto
import mock
from barbican.tests import utils
class WhenStoreCryptoAdapterPlugin(testtools.TestCase):
class WhenStoreCryptoAdapterPlugin(utils.BaseTestCase):
def setUp(self):
super(WhenStoreCryptoAdapterPlugin, self).setUp()
@ -41,7 +42,7 @@ class WhenStoreCryptoAdapterPlugin(testtools.TestCase):
self.store_crypto.generate_supports(self.key_spec))
class WhenTestingStoreCrypto(testtools.TestCase):
class WhenTestingStoreCrypto(utils.BaseTestCase):
def setUp(self):
super(WhenTestingStoreCrypto, self).setUp()

View File

@ -23,9 +23,11 @@ except ImportError:
# Symantec imports probably not available
imports_ok = False
from barbican.tests import utils
@testtools.skipIf(not imports_ok, "Symantec imports not available")
class WhenTestingSymantecPlugin(testtools.TestCase):
class WhenTestingSymantecPlugin(utils.BaseTestCase):
def setUp(self):
super(WhenTestingSymantecPlugin, self).setUp()

View File

@ -13,13 +13,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import testtools
from barbican.model import models
from barbican.plugin.util import mime_types
from barbican.tests import utils
class WhenTestingIsBase64ProcessingNeeded(testtools.TestCase):
class WhenTestingIsBase64ProcessingNeeded(utils.BaseTestCase):
def test_is_base64_needed(self):
r = mime_types.is_base64_processing_needed('application/octet-stream',
@ -48,7 +47,7 @@ class WhenTestingIsBase64ProcessingNeeded(testtools.TestCase):
self.assertFalse(r)
class WhenTestingIsBase64ProcessingSupported(testtools.TestCase):
class WhenTestingIsBase64ProcessingSupported(utils.BaseTestCase):
def test_is_base64_supported_application_octet_stream(self):
r = mime_types.is_base64_encoding_supported('application/octet-stream')
@ -62,7 +61,7 @@ class WhenTestingIsBase64ProcessingSupported(testtools.TestCase):
self.assertFalse(r)
class WhenTestingAugmentFieldsWithContentTypes(testtools.TestCase):
class WhenTestingAugmentFieldsWithContentTypes(utils.BaseTestCase):
def setUp(self):
super(WhenTestingAugmentFieldsWithContentTypes, self).setUp()
@ -113,7 +112,7 @@ class WhenTestingAugmentFieldsWithContentTypes(testtools.TestCase):
self.assertEqual(self.datum.content_type, content_types['default'])
class WhenTestingNormalizationOfMIMETypes(testtools.TestCase):
class WhenTestingNormalizationOfMIMETypes(utils.BaseTestCase):
def test_plain_text_normalization(self):
mimes = ['text/plain',

View File

@ -14,14 +14,14 @@
# limitations under the License.
import mock
import testtools
from barbican.common import hrefs
from barbican.plugin.interface import certificate_manager as cert_man
from barbican.tasks import certificate_resources as cert_res
from barbican.tests import utils
class WhenPerformingPrivateOperations(testtools.TestCase):
class WhenPerformingPrivateOperations(utils.BaseTestCase):
"""Tests private methods within certificate_resources.py."""
def test_get_plugin_meta(self):
@ -94,7 +94,7 @@ class WhenPerformingPrivateOperations(testtools.TestCase):
'between the expected and test dicts')
class WhenIssuingCertificateRequests(testtools.TestCase):
class WhenIssuingCertificateRequests(utils.BaseTestCase):
"""Tests the 'issue_certificate_request()' function."""
def setUp(self):

View File

@ -14,15 +14,15 @@
# limitations under the License.
import mock
import testtools
from barbican.model import models
from barbican.openstack.common import gettextutils as u
from barbican.openstack.common import timeutils
from barbican.tasks import resources
from barbican.tests import utils
class WhenBeginningOrder(testtools.TestCase):
class WhenBeginningOrder(utils.BaseTestCase):
def setUp(self):
super(WhenBeginningOrder, self).setUp()
@ -171,7 +171,7 @@ class WhenBeginningOrder(testtools.TestCase):
)
class WhenBeginningKeyTypeOrder(testtools.TestCase):
class WhenBeginningKeyTypeOrder(utils.BaseTestCase):
def setUp(self):
super(WhenBeginningKeyTypeOrder, self).setUp()
@ -325,7 +325,7 @@ class WhenBeginningKeyTypeOrder(testtools.TestCase):
)
class WhenBeginningAsymmetricTypeOrder(testtools.TestCase):
class WhenBeginningAsymmetricTypeOrder(utils.BaseTestCase):
def setUp(self):
super(WhenBeginningAsymmetricTypeOrder, self).setUp()

View File

@ -12,10 +12,10 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import testtools
import oslotest.base as oslotest
class BaseTestCase(testtools.TestCase):
class BaseTestCase(oslotest.BaseTestCase):
def setUp(self):
super(BaseTestCase, self).setUp()
self.order_id = 'order1234'

View File

@ -13,11 +13,13 @@ 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 oslotest.base as oslotest
from tempest import auth
from tempest import clients
from tempest.common import rest_client
from tempest import config
import testtools
CONF = config.CONF
@ -36,7 +38,7 @@ class BarbicanClient(rest_client.RestClient):
self.endpoint_url = 'publicURL'
class TestCase(testtools.TestCase):
class TestCase(oslotest.BaseTestCase):
def setUp(self):
super(TestCase, self).setUp()

View File

@ -2,6 +2,7 @@ coverage>=3.6
discover
hacking>=0.8.0,<0.9
mock>=1.0
oslotest>=1.1.0.0a1
testrepository>=0.0.18
testtools>=0.9.34