Use oslotest instead of common test module
Module openstack.common.test is obsolete, so we should use oslotest library instead of it. Modified tests and common database code, new requirement added. Change-Id: I853e548f11a4c3785eaf75124510a6d789536634
This commit is contained in:
committed by
Ilya Pekelny
parent
5016ac15e2
commit
8a0f581ac0
@@ -18,12 +18,12 @@ import functools
|
||||
import os
|
||||
|
||||
import fixtures
|
||||
from oslotest import base as test_base
|
||||
import six
|
||||
|
||||
from openstack.common.db.sqlalchemy import session
|
||||
from openstack.common.db.sqlalchemy import utils
|
||||
from openstack.common.fixture import lockutils
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class DbFixture(fixtures.Fixture):
|
||||
@@ -51,7 +51,7 @@ class DbFixture(fixtures.Fixture):
|
||||
self.addCleanup(self.test.engine.dispose)
|
||||
|
||||
|
||||
class DbTestCase(test.BaseTestCase):
|
||||
class DbTestCase(test_base.BaseTestCase):
|
||||
"""Base class for testing of DB code.
|
||||
|
||||
Using `DbFixture`. Intended to be the main database test case to use all
|
||||
|
||||
@@ -20,6 +20,7 @@ import os
|
||||
import subprocess
|
||||
|
||||
import lockfile
|
||||
from oslotest import base as test_base
|
||||
from six import moves
|
||||
from six.moves.urllib import parse
|
||||
import sqlalchemy
|
||||
@@ -27,7 +28,6 @@ import sqlalchemy.exc
|
||||
|
||||
from openstack.common.db.sqlalchemy import utils
|
||||
from openstack.common.gettextutils import _LE
|
||||
from openstack.common import test
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@@ -68,7 +68,7 @@ def _set_db_lock(lock_path=None, lock_prefix=None):
|
||||
return decorator
|
||||
|
||||
|
||||
class BaseMigrationTestCase(test.BaseTestCase):
|
||||
class BaseMigrationTestCase(test_base.BaseTestCase):
|
||||
"""Base class fort testing of migration utils."""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
||||
@@ -9,6 +9,7 @@ kombu>=2.4.8
|
||||
lockfile>=0.8
|
||||
netaddr>=0.7.6
|
||||
oslo.config>=1.2.0
|
||||
oslotest
|
||||
PasteDeploy>=1.5.0
|
||||
pbr>=0.6,!=0.7,<1.0
|
||||
posix_ipc
|
||||
|
||||
@@ -10,6 +10,7 @@ kombu>=2.4.8
|
||||
lockfile>=0.8
|
||||
netaddr>=0.7.6
|
||||
oslo.config>=1.2.0
|
||||
oslotest
|
||||
PasteDeploy>=1.5.0
|
||||
pbr>=0.6,!=0.7,<1.0
|
||||
posix_ipc
|
||||
|
||||
@@ -17,6 +17,7 @@ import argparse
|
||||
|
||||
import fixtures
|
||||
import mock
|
||||
from oslotest import base as test_base
|
||||
import requests
|
||||
from stevedore import extension
|
||||
|
||||
@@ -28,7 +29,6 @@ except ImportError:
|
||||
from openstack.common.apiclient import auth
|
||||
from openstack.common.apiclient import client
|
||||
from openstack.common.apiclient import fake_client
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
TEST_REQUEST_BASE = {
|
||||
@@ -87,7 +87,7 @@ class BaseFakePlugin(auth.BaseAuthPlugin):
|
||||
pass
|
||||
|
||||
|
||||
class GlobalFunctionsTest(test.BaseTestCase):
|
||||
class GlobalFunctionsTest(test_base.BaseTestCase):
|
||||
|
||||
def test_load_auth_system_opts(self):
|
||||
self.useFixture(fixtures.MonkeyPatch(
|
||||
@@ -110,7 +110,7 @@ class MockEntrypoint(object):
|
||||
self.plugin = plugin
|
||||
|
||||
|
||||
class AuthPluginTest(test.BaseTestCase):
|
||||
class AuthPluginTest(test_base.BaseTestCase):
|
||||
@mock.patch.object(requests.Session, "request")
|
||||
@mock.patch.object(extension.ExtensionManager, "map")
|
||||
def test_auth_system_success(self, mock_mgr_map, mock_request):
|
||||
|
||||
@@ -13,11 +13,12 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common.apiclient import base
|
||||
from openstack.common.apiclient import client
|
||||
from openstack.common.apiclient import exceptions
|
||||
from openstack.common.apiclient import fake_client
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class HumanResource(base.Resource):
|
||||
@@ -118,7 +119,7 @@ class TestClient(client.BaseClient):
|
||||
self.crud_resources = CrudResourceManager(self)
|
||||
|
||||
|
||||
class ResourceTest(test.BaseTestCase):
|
||||
class ResourceTest(test_base.BaseTestCase):
|
||||
|
||||
def test_resource_repr(self):
|
||||
r = base.Resource(None, dict(foo="bar", baz="spam"))
|
||||
@@ -136,7 +137,7 @@ class ResourceTest(test.BaseTestCase):
|
||||
self.assertEqual(r.human_id, "1")
|
||||
|
||||
|
||||
class BaseManagerTest(test.BaseTestCase):
|
||||
class BaseManagerTest(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(BaseManagerTest, self).setUp()
|
||||
@@ -184,7 +185,7 @@ class BaseManagerTest(test.BaseTestCase):
|
||||
self.assertEqual(human_resource.name, name)
|
||||
|
||||
|
||||
class CrudManagerTest(test.BaseTestCase):
|
||||
class CrudManagerTest(test_base.BaseTestCase):
|
||||
|
||||
domain_id = "my-domain"
|
||||
crud_resource_id = "1"
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from oslotest import base as test_base
|
||||
import requests
|
||||
|
||||
from openstack.common.apiclient import auth
|
||||
from openstack.common.apiclient import client
|
||||
from openstack.common.apiclient import exceptions
|
||||
from openstack.common.apiclient import fake_client
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class TestClient(client.BaseClient):
|
||||
@@ -41,7 +41,7 @@ class FakeAuthPlugin(auth.BaseAuthPlugin):
|
||||
return ("token-%s" % self.attempt, "/endpoint-%s" % self.attempt)
|
||||
|
||||
|
||||
class ClientTest(test.BaseTestCase):
|
||||
class ClientTest(test_base.BaseTestCase):
|
||||
|
||||
def test_client_with_timeout(self):
|
||||
http_client = client.HTTPClient(None, timeout=2)
|
||||
@@ -178,7 +178,7 @@ class ClientTest(test.BaseTestCase):
|
||||
TestClient(http_client), "GET", "/resource", json={"1": "2"})
|
||||
|
||||
|
||||
class FakeClientTest(test.BaseTestCase):
|
||||
class FakeClientTest(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(FakeClientTest, self).setUp()
|
||||
@@ -217,7 +217,7 @@ class FakeClient21(object):
|
||||
pass
|
||||
|
||||
|
||||
class GetClientClassTestCase(test.BaseTestCase):
|
||||
class GetClientClassTestCase(test_base.BaseTestCase):
|
||||
version_map = {
|
||||
"1": "%s.FakeClient1" % __name__,
|
||||
"2.1": "%s.FakeClient21" % __name__,
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslotest import base as test_base
|
||||
import six
|
||||
|
||||
from openstack.common.apiclient import exceptions
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class FakeResponse(object):
|
||||
@@ -30,7 +30,7 @@ class FakeResponse(object):
|
||||
return self.json_data
|
||||
|
||||
|
||||
class ExceptionsArgsTest(test.BaseTestCase):
|
||||
class ExceptionsArgsTest(test_base.BaseTestCase):
|
||||
|
||||
def assert_exception(self, ex_cls, method, url, status_code, json_data):
|
||||
ex = exceptions.from_response(
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
# under the License.
|
||||
|
||||
import fixtures
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common.config import generator
|
||||
from openstack.common.fixture import mockpatch
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class GeneratorTestcase(test.BaseTestCase):
|
||||
class GeneratorTestcase(test_base.BaseTestCase):
|
||||
# The .py suffix left out for file fblaa_opt, to trigger the ext_names
|
||||
# code snippet in generator.generate()
|
||||
conffiles = ["tests/testmods/baar_baa_opt.py",
|
||||
|
||||
@@ -16,11 +16,12 @@
|
||||
Unit Tests for crypto utils.
|
||||
"""
|
||||
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common.crypto import utils as cryptoutils
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class CryptoUtilsTestCase(test.BaseTestCase):
|
||||
class CryptoUtilsTestCase(test_base.BaseTestCase):
|
||||
|
||||
# Uses Tests from RFC5869
|
||||
def _test_HKDF(self, ikm, prk, okm, length,
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common.db.sqlalchemy.migration_cli import ext_alembic
|
||||
from openstack.common.db.sqlalchemy.migration_cli import ext_migrate
|
||||
from openstack.common.db.sqlalchemy.migration_cli import manager
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class MockWithCmp(mock.MagicMock):
|
||||
@@ -28,7 +28,7 @@ class MockWithCmp(mock.MagicMock):
|
||||
|
||||
@mock.patch(('openstack.common.db.sqlalchemy.migration_cli.'
|
||||
'ext_alembic.alembic.command'))
|
||||
class TestAlembicExtension(test.BaseTestCase):
|
||||
class TestAlembicExtension(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.migration_config = {'alembic_ini_path': '.',
|
||||
@@ -88,7 +88,7 @@ class TestAlembicExtension(test.BaseTestCase):
|
||||
|
||||
@mock.patch(('openstack.common.db.sqlalchemy.migration_cli.'
|
||||
'ext_migrate.migration'))
|
||||
class TestMigrateExtension(test.BaseTestCase):
|
||||
class TestMigrateExtension(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.migration_config = {'migration_repo_path': '.',
|
||||
@@ -147,7 +147,7 @@ class TestMigrateExtension(test.BaseTestCase):
|
||||
init_version=self.migration_config['init_version'])
|
||||
|
||||
|
||||
class TestMigrationManager(test.BaseTestCase):
|
||||
class TestMigrationManager(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.migration_config = {'alembic_ini_path': '.',
|
||||
@@ -188,7 +188,7 @@ class TestMigrationManager(test.BaseTestCase):
|
||||
self.ext.obj.stamp.assert_called_once_with('stamp')
|
||||
|
||||
|
||||
class TestMigrationRightOrder(test.BaseTestCase):
|
||||
class TestMigrationRightOrder(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.migration_config = {'alembic_ini_path': '.',
|
||||
|
||||
@@ -15,12 +15,12 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common.db.sqlalchemy import test_migrations as migrate
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class TestWalkVersions(test.BaseTestCase, migrate.WalkVersionsMixin):
|
||||
class TestWalkVersions(test_base.BaseTestCase, migrate.WalkVersionsMixin):
|
||||
def setUp(self):
|
||||
super(TestWalkVersions, self).setUp()
|
||||
self.migration_api = mock.MagicMock()
|
||||
|
||||
@@ -13,13 +13,13 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslotest import base as oslo_test
|
||||
from sqlalchemy import Column
|
||||
from sqlalchemy import Integer, String
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
|
||||
from openstack.common.db.sqlalchemy import models
|
||||
from openstack.common.db.sqlalchemy import test_base
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
BASE = declarative_base()
|
||||
@@ -111,7 +111,7 @@ class ExtraKeysModel(BASE, models.ModelBase):
|
||||
return ['name']
|
||||
|
||||
|
||||
class TimestampMixinTest(test.BaseTestCase):
|
||||
class TimestampMixinTest(oslo_test.BaseTestCase):
|
||||
|
||||
def test_timestampmixin_attr(self):
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import logging
|
||||
|
||||
import _mysql_exceptions
|
||||
import mock
|
||||
from oslotest import base as oslo_test
|
||||
import sqlalchemy
|
||||
from sqlalchemy import Column, MetaData, Table, UniqueConstraint
|
||||
from sqlalchemy import DateTime, Integer, String
|
||||
@@ -33,7 +34,6 @@ from openstack.common.db.sqlalchemy import models
|
||||
from openstack.common.db.sqlalchemy import session
|
||||
from openstack.common.db.sqlalchemy import test_base
|
||||
from openstack.common import log
|
||||
from openstack.common import test
|
||||
from tests.unit import test_log
|
||||
|
||||
|
||||
@@ -213,7 +213,7 @@ class FakeDB2Engine(object):
|
||||
pass
|
||||
|
||||
|
||||
class TestDBDisconnected(test.BaseTestCase):
|
||||
class TestDBDisconnected(oslo_test.BaseTestCase):
|
||||
|
||||
def _test_ping_listener_disconnected(self, connection):
|
||||
engine_args = {
|
||||
@@ -326,7 +326,7 @@ class MySQLTraditionalModeTestCase(MySQLStrictAllTablesModeTestCase):
|
||||
self.mysql_mode = 'TRADITIONAL'
|
||||
|
||||
|
||||
class EngineFacadeTestCase(test.BaseTestCase):
|
||||
class EngineFacadeTestCase(oslo_test.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(EngineFacadeTestCase, self).setUp()
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import warnings
|
||||
|
||||
from migrate.changeset import UniqueConstraint
|
||||
import mock
|
||||
from oslotest import base as test_base
|
||||
import six
|
||||
from six import moves
|
||||
from six.moves.urllib import parse
|
||||
@@ -38,14 +39,13 @@ from openstack.common.db.sqlalchemy import session
|
||||
from openstack.common.db.sqlalchemy import test_migrations
|
||||
from openstack.common.db.sqlalchemy import utils
|
||||
from openstack.common.fixture import moxstubout
|
||||
from openstack.common import test
|
||||
from tests import utils as test_utils
|
||||
|
||||
|
||||
SA_VERSION = tuple(map(int, sqlalchemy.__version__.split('.')))
|
||||
|
||||
|
||||
class TestSanitizeDbUrl(test.BaseTestCase):
|
||||
class TestSanitizeDbUrl(test_base.BaseTestCase):
|
||||
|
||||
def test_url_with_cred(self):
|
||||
db_url = 'myproto://johndoe:secret@localhost/myschema'
|
||||
@@ -86,7 +86,7 @@ class FakeModel(object):
|
||||
return '<FakeModel: %s>' % self.values
|
||||
|
||||
|
||||
class TestPaginateQuery(test.BaseTestCase):
|
||||
class TestPaginateQuery(test_base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(TestPaginateQuery, self).setUp()
|
||||
mox_fixture = self.useFixture(moxstubout.MoxStubout())
|
||||
@@ -663,7 +663,7 @@ class TestConnectionUtils(test_utils.BaseTestCase):
|
||||
('dude', 'pass', 'test', 'localhost'))
|
||||
|
||||
|
||||
class TestRaiseDuplicateEntryError(test.BaseTestCase):
|
||||
class TestRaiseDuplicateEntryError(test_base.BaseTestCase):
|
||||
def _test_impl(self, engine_name, error_msg):
|
||||
try:
|
||||
error = sqlalchemy.exc.IntegrityError('test', 'test', error_msg)
|
||||
@@ -725,7 +725,7 @@ class MyModelSoftDeleted(declarative_base(), models.ModelBase,
|
||||
id = Column(Integer, primary_key=True)
|
||||
|
||||
|
||||
class TestModelQuery(test.BaseTestCase):
|
||||
class TestModelQuery(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestModelQuery, self).setUp()
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from oslotest import base as test_base
|
||||
import webob.dec
|
||||
import webob.exc
|
||||
|
||||
from openstack.common.middleware import catch_errors
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class CatchErrorsTest(test.BaseTestCase):
|
||||
class CatchErrorsTest(test_base.BaseTestCase):
|
||||
|
||||
def _test_has_request_id(self, application, expected_code=None):
|
||||
app = catch_errors.CatchErrorsMiddleware(application)
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
import uuid
|
||||
|
||||
import mock
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common.fixture import moxstubout
|
||||
from openstack.common.middleware import correlation_id
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class CorrelationIdMiddlewareTest(test.BaseTestCase):
|
||||
class CorrelationIdMiddlewareTest(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(CorrelationIdMiddlewareTest, self).setUp()
|
||||
|
||||
@@ -14,15 +14,15 @@
|
||||
# under the License.
|
||||
|
||||
|
||||
from oslotest import base as test_base
|
||||
from testtools import matchers
|
||||
import webob
|
||||
import webob.dec
|
||||
|
||||
from openstack.common.middleware import request_id
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class RequestIdTest(test.BaseTestCase):
|
||||
class RequestIdTest(test_base.BaseTestCase):
|
||||
def test_generate_request_id(self):
|
||||
@webob.dec.wsgify
|
||||
def application(req):
|
||||
|
||||
@@ -12,15 +12,15 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslotest import base as test_base
|
||||
import six
|
||||
import webob
|
||||
|
||||
from openstack.common.fixture import config
|
||||
from openstack.common.middleware import sizelimit
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class TestLimitingReader(test.BaseTestCase):
|
||||
class TestLimitingReader(test_base.BaseTestCase):
|
||||
|
||||
def test_limiting_reader(self):
|
||||
BYTES = 1024
|
||||
@@ -66,7 +66,7 @@ class TestLimitingReader(test.BaseTestCase):
|
||||
_consume_all_read)
|
||||
|
||||
|
||||
class TestRequestBodySizeLimiter(test.BaseTestCase):
|
||||
class TestRequestBodySizeLimiter(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestRequestBodySizeLimiter, self).setUp()
|
||||
|
||||
@@ -23,12 +23,12 @@ import logging
|
||||
import time
|
||||
|
||||
import eventlet
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common.fixture import config
|
||||
from openstack.common.gettextutils import _
|
||||
from openstack.common.rpc import common as rpc_common
|
||||
from openstack.common.rpc import dispatcher as rpc_dispatcher
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@@ -41,7 +41,7 @@ class ApiError(Exception):
|
||||
super(ApiError, self).__init__('%s: %s' % (code, message))
|
||||
|
||||
|
||||
class BaseRpcTestCase(test.BaseTestCase):
|
||||
class BaseRpcTestCase(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self, supports_timeouts=True, topic='test',
|
||||
topic_nested='nested'):
|
||||
|
||||
@@ -19,6 +19,7 @@ Unit Tests for 'common' functons used through rpc code.
|
||||
import logging
|
||||
import sys
|
||||
|
||||
from oslotest import base as test_base
|
||||
import six
|
||||
|
||||
from openstack.common.fixture import config
|
||||
@@ -26,7 +27,6 @@ from openstack.common import importutils
|
||||
from openstack.common import jsonutils
|
||||
from openstack.common import rpc
|
||||
from openstack.common.rpc import common as rpc_common
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@@ -38,7 +38,7 @@ class FakeUserDefinedException(Exception):
|
||||
self.kwargs = kwargs
|
||||
|
||||
|
||||
class RpcCommonTestCase(test.BaseTestCase):
|
||||
class RpcCommonTestCase(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(RpcCommonTestCase, self).setUp()
|
||||
|
||||
@@ -16,15 +16,16 @@
|
||||
Unit Tests for rpc.dispatcher
|
||||
"""
|
||||
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common import context
|
||||
from openstack.common.fixture import moxstubout
|
||||
from openstack.common.rpc import common as rpc_common
|
||||
from openstack.common.rpc import dispatcher
|
||||
from openstack.common.rpc import serializer as rpc_serializer
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class RpcDispatcherTestCase(test.BaseTestCase):
|
||||
class RpcDispatcherTestCase(test_base.BaseTestCase):
|
||||
class API1(object):
|
||||
RPC_API_VERSION = '1.0'
|
||||
|
||||
|
||||
@@ -29,13 +29,13 @@ import weakref
|
||||
|
||||
import fixtures
|
||||
import mock
|
||||
from oslotest import base as test_base
|
||||
import six
|
||||
|
||||
from openstack.common.fixture import config
|
||||
from openstack.common.fixture import moxstubout
|
||||
from openstack.common.rpc import amqp as rpc_amqp
|
||||
from openstack.common.rpc import common as rpc_common
|
||||
from openstack.common import test as test_base
|
||||
from tests.unit.rpc import amqp
|
||||
from tests.unit.rpc import common
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@ import ssl
|
||||
|
||||
import eventlet
|
||||
eventlet.monkey_patch()
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common.fixture import config
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
try:
|
||||
@@ -42,7 +42,7 @@ SSL_CA_CERT = "/tmp/cert.ca.blah.blah"
|
||||
SSL_KEYFILE = "/tmp/keyfile.blah.blah"
|
||||
|
||||
|
||||
class RpcKombuSslTestCase(test.BaseTestCase):
|
||||
class RpcKombuSslTestCase(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(RpcKombuSslTestCase, self).setUp()
|
||||
@@ -74,7 +74,7 @@ class RpcKombuSslTestCase(test.BaseTestCase):
|
||||
#Into python ssl creation...
|
||||
|
||||
|
||||
class RpcKombuSslBadVersionTestCase(test.BaseTestCase):
|
||||
class RpcKombuSslBadVersionTestCase(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(RpcKombuSslBadVersionTestCase, self).setUp()
|
||||
|
||||
@@ -14,16 +14,18 @@
|
||||
|
||||
import logging
|
||||
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common.rpc import matchmaker
|
||||
from openstack.common.rpc import matchmaker_ring
|
||||
from openstack.common import test
|
||||
from tests.unit.rpc import matchmaker_common as common
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class MatchMakerFileTestCase(test.BaseTestCase, common._MatchMakerTestCase):
|
||||
class MatchMakerFileTestCase(test_base.BaseTestCase,
|
||||
common._MatchMakerTestCase):
|
||||
def setUp(self):
|
||||
super(MatchMakerFileTestCase, self).setUp()
|
||||
self.topic = "test"
|
||||
@@ -34,7 +36,7 @@ class MatchMakerFileTestCase(test.BaseTestCase, common._MatchMakerTestCase):
|
||||
self.driver = matchmaker_ring.MatchMakerRing(ring)
|
||||
|
||||
|
||||
class MatchMakerLocalhostTestCase(test.BaseTestCase,
|
||||
class MatchMakerLocalhostTestCase(test_base.BaseTestCase,
|
||||
common._MatchMakerTestCase):
|
||||
def setUp(self):
|
||||
super(MatchMakerLocalhostTestCase, self).setUp()
|
||||
@@ -43,7 +45,7 @@ class MatchMakerLocalhostTestCase(test.BaseTestCase,
|
||||
self.hosts = ['localhost']
|
||||
|
||||
|
||||
class MatchMakerDirectExchangeTestCase(test.BaseTestCase, common.
|
||||
class MatchMakerDirectExchangeTestCase(test_base.BaseTestCase, common.
|
||||
_MatchMakerDirectedTopicTestCase):
|
||||
"""Test lookups against a directed topic."""
|
||||
def setUp(self):
|
||||
@@ -53,7 +55,7 @@ class MatchMakerDirectExchangeTestCase(test.BaseTestCase, common.
|
||||
self.hosts = ['localhost']
|
||||
|
||||
|
||||
class MatchMakerStubTestCase(test.BaseTestCase,
|
||||
class MatchMakerStubTestCase(test_base.BaseTestCase,
|
||||
common._MatchMakerDirectedTopicTestCase):
|
||||
"""Test lookups against the stub/no-op matchmaker."""
|
||||
def setUp(self):
|
||||
|
||||
@@ -15,12 +15,12 @@
|
||||
import logging
|
||||
|
||||
import eventlet
|
||||
from oslotest import base as test_base
|
||||
from six import moves
|
||||
|
||||
from openstack.common.fixture import config
|
||||
from openstack.common import importutils
|
||||
from openstack.common.rpc import matchmaker_redis as matchmaker
|
||||
from openstack.common import test
|
||||
from tests.unit.rpc import matchmaker_common as common
|
||||
|
||||
redis = importutils.try_import('redis')
|
||||
@@ -28,7 +28,7 @@ redis = importutils.try_import('redis')
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class MatchMakerRedisLookupTestCase(test.BaseTestCase,
|
||||
class MatchMakerRedisLookupTestCase(test_base.BaseTestCase,
|
||||
common._MatchMakerTestCase):
|
||||
"""Test lookups against the Redis matchmaker"""
|
||||
def setUp(self):
|
||||
@@ -67,7 +67,7 @@ class MatchMakerRedisLookupTestCase(test.BaseTestCase,
|
||||
self.driver.stop_heartbeat()
|
||||
|
||||
|
||||
class MatchMakerRedisHeartbeatTestCase(test.BaseTestCase,
|
||||
class MatchMakerRedisHeartbeatTestCase(test_base.BaseTestCase,
|
||||
common._MatchMakerDynRegTestCase):
|
||||
"""Test the ability to register and perform heartbeats."""
|
||||
def setUp(self):
|
||||
@@ -124,7 +124,7 @@ class MatchMakerRedisHeartbeatTestCase(test.BaseTestCase,
|
||||
self.assertEqual(self.driver.queues(self.topic), [])
|
||||
|
||||
|
||||
class MatchMakerRedisTestCase(test.BaseTestCase):
|
||||
class MatchMakerRedisTestCase(test_base.BaseTestCase):
|
||||
"""Generic tests that do not require a Redis server."""
|
||||
def test_redis_import_exception(self):
|
||||
"""Try initializing an object without redis."""
|
||||
|
||||
@@ -18,6 +18,7 @@ Unit Tests for rpc.proxy
|
||||
|
||||
import copy
|
||||
|
||||
from oslotest import base as test_base
|
||||
import six
|
||||
|
||||
from openstack.common import context
|
||||
@@ -27,10 +28,9 @@ from openstack.common import rpc
|
||||
from openstack.common.rpc import common as rpc_common
|
||||
from openstack.common.rpc import proxy
|
||||
from openstack.common.rpc import serializer as rpc_serializer
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class RpcProxyTestCase(test.BaseTestCase):
|
||||
class RpcProxyTestCase(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(RpcProxyTestCase, self).setUp()
|
||||
|
||||
@@ -14,9 +14,10 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common.fixture import config
|
||||
from openstack.common.rpc import service
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class FakeService(service.Service):
|
||||
@@ -41,7 +42,7 @@ class FakeHookService(FakeService):
|
||||
return self.hooked
|
||||
|
||||
|
||||
class RpcServiceManagerTestCase(test.BaseTestCase):
|
||||
class RpcServiceManagerTestCase(test_base.BaseTestCase):
|
||||
"""Test cases for Services."""
|
||||
def setUp(self):
|
||||
super(RpcServiceManagerTestCase, self).setUp()
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
# limitations under the License.
|
||||
|
||||
import mock
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common.fixture import moxstubout
|
||||
from openstack.common.scheduler import base_filter
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class TestBaseFilter(test.BaseTestCase):
|
||||
class TestBaseFilter(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestBaseFilter, self).setUp()
|
||||
@@ -104,7 +104,7 @@ class FakeExtensionManager(list):
|
||||
self.namespace = namespace
|
||||
|
||||
|
||||
class TestBaseFilterHandler(test.BaseTestCase):
|
||||
class TestBaseFilterHandler(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestBaseFilterHandler, self).setUp()
|
||||
|
||||
@@ -17,11 +17,12 @@
|
||||
Tests For Scheduler Host Filters.
|
||||
"""
|
||||
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common import context
|
||||
from openstack.common import jsonutils
|
||||
from openstack.common.scheduler import filters
|
||||
from openstack.common.scheduler.filters import extra_specs_ops
|
||||
from openstack.common import test
|
||||
from tests.unit.scheduler import fake_hosts as fakes
|
||||
|
||||
|
||||
@@ -34,7 +35,7 @@ class TestBogusFilter(object):
|
||||
pass
|
||||
|
||||
|
||||
class ExtraSpecsOpsTestCase(test.BaseTestCase):
|
||||
class ExtraSpecsOpsTestCase(test_base.BaseTestCase):
|
||||
def _do_extra_specs_ops_test(self, value, req, matches):
|
||||
assertion = self.assertTrue if matches else self.assertFalse
|
||||
assertion(extra_specs_ops.match(value, req))
|
||||
@@ -250,7 +251,7 @@ class ExtraSpecsOpsTestCase(test.BaseTestCase):
|
||||
matches=False)
|
||||
|
||||
|
||||
class HostFiltersTestCase(test.BaseTestCase):
|
||||
class HostFiltersTestCase(test_base.BaseTestCase):
|
||||
"""Test case for host filters."""
|
||||
|
||||
def setUp(self):
|
||||
|
||||
@@ -17,12 +17,13 @@
|
||||
Tests For Scheduler weights.
|
||||
"""
|
||||
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common.scheduler import base_weight
|
||||
from openstack.common import test
|
||||
from tests.unit import fakes
|
||||
|
||||
|
||||
class TestWeightHandler(test.BaseTestCase):
|
||||
class TestWeightHandler(test_base.BaseTestCase):
|
||||
def test_get_all_classes(self):
|
||||
namespace = "openstack.common.tests.fakes.weights"
|
||||
handler = base_weight.BaseWeightHandler(
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
# under the License.
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common import cfgfilter
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class ConfigFilterTestCase(test.BaseTestCase):
|
||||
class ConfigFilterTestCase(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(ConfigFilterTestCase, self).setUp()
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
|
||||
import fixtures
|
||||
import mock
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common.apiclient import base
|
||||
from openstack.common.apiclient import exceptions
|
||||
from openstack.common import cliutils
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class ValidateArgsTest(test.BaseTestCase):
|
||||
class ValidateArgsTest(test_base.BaseTestCase):
|
||||
|
||||
def test_lambda_no_args(self):
|
||||
cliutils.validate_args(lambda: None)
|
||||
@@ -435,7 +435,7 @@ class _FakeResult(object):
|
||||
self.value = value
|
||||
|
||||
|
||||
class PrintResultTestCase(test.BaseTestCase):
|
||||
class PrintResultTestCase(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(PrintResultTestCase, self).setUp()
|
||||
@@ -498,7 +498,7 @@ class PrintResultTestCase(test.BaseTestCase):
|
||||
mock.call(["", "Value"])])
|
||||
|
||||
|
||||
class DecoratorsTestCase(test.BaseTestCase):
|
||||
class DecoratorsTestCase(test_base.BaseTestCase):
|
||||
|
||||
def test_arg(self):
|
||||
func_args = [("--image", ), ("--flavor", )]
|
||||
@@ -526,7 +526,7 @@ class DecoratorsTestCase(test.BaseTestCase):
|
||||
self.assertTrue(cliutils.isunauthenticated(dummy_func))
|
||||
|
||||
|
||||
class EnvTestCase(test.BaseTestCase):
|
||||
class EnvTestCase(test_base.BaseTestCase):
|
||||
|
||||
def test_env(self):
|
||||
env = {"alpha": "a", "beta": "b"}
|
||||
@@ -539,7 +539,7 @@ class EnvTestCase(test.BaseTestCase):
|
||||
self.assertEqual(cliutils.env("gamma", default="c"), "c")
|
||||
|
||||
|
||||
class GetPasswordTestCase(test.BaseTestCase):
|
||||
class GetPasswordTestCase(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(GetPasswordTestCase, self).setUp()
|
||||
@@ -624,7 +624,7 @@ class FakeDisplayManager(FakeManager):
|
||||
]
|
||||
|
||||
|
||||
class FindResourceTestCase(test.BaseTestCase):
|
||||
class FindResourceTestCase(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(FindResourceTestCase, self).setUp()
|
||||
|
||||
@@ -13,11 +13,12 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common import context
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class ContextTest(test.BaseTestCase):
|
||||
class ContextTest(test_base.BaseTestCase):
|
||||
|
||||
def test_context(self):
|
||||
ctx = context.RequestContext()
|
||||
|
||||
@@ -14,16 +14,16 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common.fixture import config
|
||||
from openstack.common.fixture import mockpatch
|
||||
from openstack.common import log as logging
|
||||
from openstack.common import test
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class DeprecatedConfigTestCase(test.BaseTestCase):
|
||||
class DeprecatedConfigTestCase(test_base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(DeprecatedConfigTestCase, self).setUp()
|
||||
|
||||
|
||||
@@ -21,14 +21,14 @@ import errno
|
||||
import socket
|
||||
|
||||
import eventlet
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common import eventlet_backdoor
|
||||
from openstack.common.fixture import config
|
||||
from openstack.common.fixture import moxstubout
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class BackdoorPortTest(test.BaseTestCase):
|
||||
class BackdoorPortTest(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(BackdoorPortTest, self).setUp()
|
||||
|
||||
@@ -16,16 +16,16 @@ import logging
|
||||
import time
|
||||
|
||||
import mock
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common import excutils
|
||||
from openstack.common.fixture import moxstubout
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
mox = moxstubout.mox
|
||||
|
||||
|
||||
class SaveAndReraiseTest(test.BaseTestCase):
|
||||
class SaveAndReraiseTest(test_base.BaseTestCase):
|
||||
|
||||
def test_save_and_reraise_exception(self):
|
||||
e = None
|
||||
@@ -82,7 +82,7 @@ class SaveAndReraiseTest(test.BaseTestCase):
|
||||
self.assertFalse(log.called)
|
||||
|
||||
|
||||
class ForeverRetryUncaughtExceptionsTest(test.BaseTestCase):
|
||||
class ForeverRetryUncaughtExceptionsTest(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(ForeverRetryUncaughtExceptionsTest, self).setUp()
|
||||
|
||||
@@ -18,14 +18,14 @@ import os
|
||||
import shutil
|
||||
import tempfile
|
||||
|
||||
from oslotest import base as test_base
|
||||
from six.moves import builtins
|
||||
from six.moves import mox
|
||||
|
||||
from openstack.common import fileutils
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class EnsureTree(test.BaseTestCase):
|
||||
class EnsureTree(test_base.BaseTestCase):
|
||||
def test_ensure_tree(self):
|
||||
tmpdir = tempfile.mkdtemp()
|
||||
try:
|
||||
@@ -38,7 +38,7 @@ class EnsureTree(test.BaseTestCase):
|
||||
shutil.rmtree(tmpdir)
|
||||
|
||||
|
||||
class TestCachedFile(test.BaseTestCase):
|
||||
class TestCachedFile(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestCachedFile, self).setUp()
|
||||
@@ -84,7 +84,7 @@ class TestCachedFile(test.BaseTestCase):
|
||||
self.assertTrue(fresh)
|
||||
|
||||
|
||||
class DeleteIfExists(test.BaseTestCase):
|
||||
class DeleteIfExists(test_base.BaseTestCase):
|
||||
def test_file_present(self):
|
||||
tmpfile = tempfile.mktemp()
|
||||
|
||||
@@ -116,7 +116,7 @@ class DeleteIfExists(test.BaseTestCase):
|
||||
os.unlink(tmpfile)
|
||||
|
||||
|
||||
class RemovePathOnError(test.BaseTestCase):
|
||||
class RemovePathOnError(test_base.BaseTestCase):
|
||||
def test_error(self):
|
||||
tmpfile = tempfile.mktemp()
|
||||
open(tmpfile, 'w')
|
||||
@@ -160,7 +160,7 @@ class RemovePathOnError(test.BaseTestCase):
|
||||
self.assertFalse(os.path.exists(tmpdir))
|
||||
|
||||
|
||||
class UtilsTestCase(test.BaseTestCase):
|
||||
class UtilsTestCase(test_base.BaseTestCase):
|
||||
def test_file_open(self):
|
||||
dst_fd, dst_path = tempfile.mkstemp()
|
||||
try:
|
||||
@@ -173,7 +173,7 @@ class UtilsTestCase(test.BaseTestCase):
|
||||
os.unlink(dst_path)
|
||||
|
||||
|
||||
class WriteToTempfileTestCase(test.BaseTestCase):
|
||||
class WriteToTempfileTestCase(test_base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(WriteToTempfileTestCase, self).setUp()
|
||||
self.content = 'testing123'
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
|
||||
import functools
|
||||
|
||||
from oslotest import base as test_base
|
||||
import six
|
||||
|
||||
from openstack.common import funcutils
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class FuncutilsTestCase(test.BaseTestCase):
|
||||
class FuncutilsTestCase(test_base.BaseTestCase):
|
||||
def _test_func(self, instance, red=None, blue=None):
|
||||
pass
|
||||
|
||||
|
||||
@@ -19,18 +19,18 @@ import logging
|
||||
|
||||
from babel import localedata
|
||||
import mock
|
||||
from oslotest import base as test_base
|
||||
import six
|
||||
import testtools
|
||||
|
||||
from openstack.common.fixture import moxstubout
|
||||
from openstack.common import gettextutils
|
||||
from openstack.common import test
|
||||
from tests.unit import fakes
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class GettextTest(test.BaseTestCase):
|
||||
class GettextTest(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(GettextTest, self).setUp()
|
||||
@@ -169,7 +169,7 @@ class GettextTest(test.BaseTestCase):
|
||||
self.assertEqual(es_translation, gettextutils.translate(obj, 'es'))
|
||||
|
||||
|
||||
class MessageTestCase(test.BaseTestCase):
|
||||
class MessageTestCase(test_base.BaseTestCase):
|
||||
"""Unit tests for locale Message class."""
|
||||
|
||||
@staticmethod
|
||||
@@ -661,7 +661,7 @@ class MessageTestCase(test.BaseTestCase):
|
||||
self.assertEqual(fr_translation, msg.translate('fr'))
|
||||
|
||||
|
||||
class TranslationHandlerTestCase(test.BaseTestCase):
|
||||
class TranslationHandlerTestCase(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TranslationHandlerTestCase, self).setUp()
|
||||
@@ -740,7 +740,7 @@ class TranslationHandlerTestCase(test.BaseTestCase):
|
||||
self.assertIn(translation, self.stream.getvalue())
|
||||
|
||||
|
||||
class LogLevelTranslationsTest(test.BaseTestCase):
|
||||
class LogLevelTranslationsTest(test_base.BaseTestCase):
|
||||
|
||||
scenarios = [
|
||||
(level, {'level': level})
|
||||
|
||||
@@ -13,15 +13,15 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslotest import base as test_base
|
||||
import testscenarios
|
||||
|
||||
from openstack.common import imageutils
|
||||
from openstack.common import test
|
||||
|
||||
load_tests = testscenarios.load_tests_apply_scenarios
|
||||
|
||||
|
||||
class ImageUtilsRawTestCase(test.BaseTestCase):
|
||||
class ImageUtilsRawTestCase(test_base.BaseTestCase):
|
||||
|
||||
_image_name = [
|
||||
('disk_config', dict(image_name='disk.config')),
|
||||
@@ -188,7 +188,7 @@ class ImageUtilsQemuTestCase(ImageUtilsRawTestCase):
|
||||
ImageUtilsQemuTestCase.generate_scenarios()
|
||||
|
||||
|
||||
class ImageUtilsBlankTestCase(test.BaseTestCase):
|
||||
class ImageUtilsBlankTestCase(test_base.BaseTestCase):
|
||||
def test_qemu_img_info_blank(self):
|
||||
example_output = '\n'.join(['image: None', 'file_format: None',
|
||||
'virtual_size: None', 'disk_size: None',
|
||||
|
||||
@@ -16,11 +16,12 @@
|
||||
import datetime
|
||||
import sys
|
||||
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common import importutils
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class ImportUtilsTest(test.BaseTestCase):
|
||||
class ImportUtilsTest(test_base.BaseTestCase):
|
||||
|
||||
# NOTE(jkoelker) There has GOT to be a way to test this. But mocking
|
||||
# __import__ is the devil. Right now we just make
|
||||
|
||||
@@ -16,15 +16,15 @@
|
||||
import datetime
|
||||
|
||||
import netaddr
|
||||
from oslotest import base as test_base
|
||||
import six
|
||||
import six.moves.xmlrpc_client as xmlrpclib
|
||||
|
||||
from openstack.common import gettextutils
|
||||
from openstack.common import jsonutils
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class JSONUtilsTestCase(test.BaseTestCase):
|
||||
class JSONUtilsTestCase(test_base.BaseTestCase):
|
||||
|
||||
def test_dumps(self):
|
||||
self.assertEqual(jsonutils.dumps({'a': 'b'}), '{"a": "b"}')
|
||||
@@ -37,7 +37,7 @@ class JSONUtilsTestCase(test.BaseTestCase):
|
||||
self.assertEqual(jsonutils.load(x), {'a': 'b'})
|
||||
|
||||
|
||||
class ToPrimitiveTestCase(test.BaseTestCase):
|
||||
class ToPrimitiveTestCase(test_base.BaseTestCase):
|
||||
def test_list(self):
|
||||
self.assertEqual(jsonutils.to_primitive([1, 2, 3]), [1, 2, 3])
|
||||
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
|
||||
import threading
|
||||
|
||||
from oslotest import base as test_base
|
||||
from six import moves
|
||||
|
||||
from openstack.common import local
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class Dict(dict):
|
||||
@@ -26,7 +26,7 @@ class Dict(dict):
|
||||
pass
|
||||
|
||||
|
||||
class LocalStoreTestCase(test.BaseTestCase):
|
||||
class LocalStoreTestCase(test_base.BaseTestCase):
|
||||
v1 = Dict(a='1')
|
||||
v2 = Dict(a='2')
|
||||
v3 = Dict(a='3')
|
||||
|
||||
@@ -26,15 +26,15 @@ import eventlet
|
||||
from eventlet import greenpool
|
||||
from eventlet import greenthread
|
||||
from oslo.config import cfg
|
||||
from oslotest import base as test_base
|
||||
from six import moves
|
||||
|
||||
from openstack.common.fixture import config
|
||||
from openstack.common.fixture import lockutils as fixtures
|
||||
from openstack.common import lockutils
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class TestFileLocks(test.BaseTestCase):
|
||||
class TestFileLocks(test_base.BaseTestCase):
|
||||
|
||||
def test_concurrent_green_lock_succeeds(self):
|
||||
"""Verify spawn_n greenthreads with two locks run concurrently."""
|
||||
@@ -70,7 +70,7 @@ class TestFileLocks(test.BaseTestCase):
|
||||
shutil.rmtree(tmpdir)
|
||||
|
||||
|
||||
class LockTestCase(test.BaseTestCase):
|
||||
class LockTestCase(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(LockTestCase, self).setUp()
|
||||
@@ -373,7 +373,7 @@ class BrokenLock(lockutils._FileLock):
|
||||
raise err
|
||||
|
||||
|
||||
class FileBasedLockingTestCase(test.BaseTestCase):
|
||||
class FileBasedLockingTestCase(test_base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(FileBasedLockingTestCase, self).setUp()
|
||||
self.lock_dir = tempfile.mkdtemp()
|
||||
@@ -460,7 +460,7 @@ class FileBasedLockingTestCase(test.BaseTestCase):
|
||||
self.assertEqual(call_list, ['other', 'other', 'main', 'main'])
|
||||
|
||||
|
||||
class LockutilsModuleTestCase(test.BaseTestCase):
|
||||
class LockutilsModuleTestCase(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(LockutilsModuleTestCase, self).setUp()
|
||||
@@ -494,7 +494,7 @@ class LockutilsModuleTestCase(test.BaseTestCase):
|
||||
self.assertEqual(retval, 0, "Bad OSLO_LOCK_PATH has been set")
|
||||
|
||||
|
||||
class TestLockFixture(test.BaseTestCase):
|
||||
class TestLockFixture(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestLockFixture, self).setUp()
|
||||
|
||||
@@ -21,6 +21,7 @@ import tempfile
|
||||
|
||||
import mock
|
||||
from oslo.config import cfg
|
||||
from oslotest import base as test_base
|
||||
import six
|
||||
|
||||
from openstack.common import context
|
||||
@@ -33,7 +34,6 @@ from openstack.common import local
|
||||
from openstack.common import log
|
||||
from openstack.common import log_handler
|
||||
from openstack.common.notifier import api as notifier
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
def _fake_context():
|
||||
@@ -98,19 +98,19 @@ class CommonLoggerTestsMixIn(object):
|
||||
self.assertRaises(AttributeError, getattr, log, func)
|
||||
|
||||
|
||||
class LoggerTestCase(CommonLoggerTestsMixIn, test.BaseTestCase):
|
||||
class LoggerTestCase(CommonLoggerTestsMixIn, test_base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(LoggerTestCase, self).setUp()
|
||||
self.log = log.getLogger(None)
|
||||
|
||||
|
||||
class LazyLoggerTestCase(CommonLoggerTestsMixIn, test.BaseTestCase):
|
||||
class LazyLoggerTestCase(CommonLoggerTestsMixIn, test_base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(LazyLoggerTestCase, self).setUp()
|
||||
self.log = log.getLazyLogger(None)
|
||||
|
||||
|
||||
class LogTestBase(test.BaseTestCase):
|
||||
class LogTestBase(test_base.BaseTestCase):
|
||||
"""Base test class that provides some convenience functions."""
|
||||
def _add_handler_with_cleanup(self, log_instance, handler=None,
|
||||
formatter=None):
|
||||
@@ -152,7 +152,7 @@ class LogTestBase(test.BaseTestCase):
|
||||
self.addCleanup(log_instance.logger.setLevel, self.level)
|
||||
|
||||
|
||||
class LogHandlerTestCase(test.BaseTestCase):
|
||||
class LogHandlerTestCase(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(LogHandlerTestCase, self).setUp()
|
||||
@@ -179,7 +179,7 @@ class LogHandlerTestCase(test.BaseTestCase):
|
||||
'/some/path/foo-bar.log')
|
||||
|
||||
|
||||
class PublishErrorsHandlerTestCase(test.BaseTestCase):
|
||||
class PublishErrorsHandlerTestCase(test_base.BaseTestCase):
|
||||
"""Tests for log.PublishErrorsHandler"""
|
||||
def setUp(self):
|
||||
super(PublishErrorsHandlerTestCase, self).setUp()
|
||||
@@ -222,7 +222,7 @@ class PublishErrorsHandlerTestCase(test.BaseTestCase):
|
||||
self.assertEqual(self.emit_payload, expect_payload)
|
||||
|
||||
|
||||
class LogLevelTestCase(test.BaseTestCase):
|
||||
class LogLevelTestCase(test_base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(LogLevelTestCase, self).setUp()
|
||||
self.CONF = self.useFixture(config.Config()).conf
|
||||
@@ -488,7 +488,7 @@ class DomainTestCase(LogTestBase):
|
||||
(ctxt.request_id, user_identity)))
|
||||
|
||||
|
||||
class SetDefaultsTestCase(test.BaseTestCase):
|
||||
class SetDefaultsTestCase(test_base.BaseTestCase):
|
||||
class TestConfigOpts(cfg.ConfigOpts):
|
||||
def __call__(self, args=None):
|
||||
return cfg.ConfigOpts.__call__(self,
|
||||
@@ -517,7 +517,7 @@ class SetDefaultsTestCase(test.BaseTestCase):
|
||||
self.assertEqual(self.conf.logging_context_format_string, my_default)
|
||||
|
||||
|
||||
class LogConfigOptsTestCase(test.BaseTestCase):
|
||||
class LogConfigOptsTestCase(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(LogConfigOptsTestCase, self).setUp()
|
||||
@@ -598,7 +598,7 @@ class LogConfigOptsTestCase(test.BaseTestCase):
|
||||
self.assertTrue(isinstance(formatter, log.ContextFormatter))
|
||||
|
||||
|
||||
class LogConfigTestCase(test.BaseTestCase):
|
||||
class LogConfigTestCase(test_base.BaseTestCase):
|
||||
|
||||
minimal_config = """[loggers]
|
||||
keys=root
|
||||
@@ -657,7 +657,7 @@ handlers=
|
||||
disable_existing_loggers=False)
|
||||
|
||||
|
||||
class MaskPasswordTestCase(test.BaseTestCase):
|
||||
class MaskPasswordTestCase(test_base.BaseTestCase):
|
||||
|
||||
def test_json(self):
|
||||
# Test 'adminPass' w/o spaces
|
||||
|
||||
@@ -15,14 +15,14 @@
|
||||
import datetime
|
||||
|
||||
from eventlet import greenthread
|
||||
from oslotest import base as test_base
|
||||
from six.moves import mox
|
||||
|
||||
from openstack.common import loopingcall
|
||||
from openstack.common import test
|
||||
from openstack.common import timeutils
|
||||
|
||||
|
||||
class LoopingCallTestCase(test.BaseTestCase):
|
||||
class LoopingCallTestCase(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(LoopingCallTestCase, self).setUp()
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
import time
|
||||
|
||||
import mock
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common import memorycache
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class MemorycacheTest(test.BaseTestCase):
|
||||
class MemorycacheTest(test_base.BaseTestCase):
|
||||
def setUp(self):
|
||||
self.client = memorycache.get_client()
|
||||
super(MemorycacheTest, self).setUp()
|
||||
|
||||
@@ -13,11 +13,12 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common import network_utils
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class NetworkUtilsTest(test.BaseTestCase):
|
||||
class NetworkUtilsTest(test_base.BaseTestCase):
|
||||
|
||||
def test_parse_host_port(self):
|
||||
self.assertEqual(('server01', 80),
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
import socket
|
||||
|
||||
import mock
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common import context
|
||||
from openstack.common.fixture import config
|
||||
@@ -26,14 +27,13 @@ from openstack.common.notifier import log_notifier
|
||||
from openstack.common.notifier import no_op_notifier
|
||||
from openstack.common.notifier import proxy
|
||||
from openstack.common import rpc
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
ctxt = context.get_admin_context()
|
||||
ctxt2 = context.get_admin_context()
|
||||
|
||||
|
||||
class NotifierTestCase(test.BaseTestCase):
|
||||
class NotifierTestCase(test_base.BaseTestCase):
|
||||
"""Test case for notifications."""
|
||||
def setUp(self):
|
||||
super(NotifierTestCase, self).setUp()
|
||||
@@ -210,7 +210,7 @@ class NotifierTestCase(test.BaseTestCase):
|
||||
self.assertIsNone(self.context_arg)
|
||||
|
||||
|
||||
class MultiNotifierTestCase(test.BaseTestCase):
|
||||
class MultiNotifierTestCase(test_base.BaseTestCase):
|
||||
"""Test case for notifications."""
|
||||
|
||||
def setUp(self):
|
||||
@@ -291,7 +291,7 @@ class MultiNotifierTestCase(test.BaseTestCase):
|
||||
'foobar.baz')
|
||||
|
||||
|
||||
class NotifierProxyTestCase(test.BaseTestCase):
|
||||
class NotifierProxyTestCase(test_base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(NotifierProxyTestCase, self).setUp()
|
||||
self.proxy = proxy.get_notifier(service='service', host='my')
|
||||
|
||||
@@ -19,10 +19,10 @@ Unit Tests for periodic_task decorator and PeriodicTasks class.
|
||||
"""
|
||||
|
||||
import mock
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common.fixture import config
|
||||
from openstack.common import periodic_task
|
||||
from openstack.common import test
|
||||
from testtools import matchers
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ class AService(periodic_task.PeriodicTasks):
|
||||
self.called['tocks'] += 1
|
||||
|
||||
|
||||
class PeriodicTasksTestCase(test.BaseTestCase):
|
||||
class PeriodicTasksTestCase(test_base.BaseTestCase):
|
||||
"""Test cases for PeriodicTasks."""
|
||||
|
||||
@mock.patch('time.time')
|
||||
@@ -92,7 +92,7 @@ class PeriodicTasksTestCase(test.BaseTestCase):
|
||||
None, raise_on_error=True)
|
||||
|
||||
|
||||
class ManagerMetaTestCase(test.BaseTestCase):
|
||||
class ManagerMetaTestCase(test_base.BaseTestCase):
|
||||
"""Tests for the meta class which manages the creation of periodic tasks.
|
||||
"""
|
||||
|
||||
@@ -119,7 +119,7 @@ class ManagerMetaTestCase(test.BaseTestCase):
|
||||
m._periodic_spacing, matchers.Not(matchers.Contains('baz')))
|
||||
|
||||
|
||||
class ManagerTestCase(test.BaseTestCase):
|
||||
class ManagerTestCase(test_base.BaseTestCase):
|
||||
"""Tests the periodic tasks portion of the manager class."""
|
||||
def setUp(self):
|
||||
super(ManagerTestCase, self).setUp()
|
||||
|
||||
@@ -19,6 +19,7 @@ import os
|
||||
|
||||
import mock
|
||||
from oslo.config import cfg
|
||||
from oslotest import base as test_base
|
||||
import six
|
||||
import six.moves.urllib.parse as urlparse
|
||||
import six.moves.urllib.request as urlrequest
|
||||
@@ -27,7 +28,6 @@ from openstack.common.fixture import config
|
||||
from openstack.common.fixture import lockutils
|
||||
from openstack.common import jsonutils
|
||||
from openstack.common import policy
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
TEST_VAR_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__),
|
||||
@@ -42,7 +42,7 @@ class MyException(Exception):
|
||||
self.kwargs = kwargs
|
||||
|
||||
|
||||
class RulesTestCase(test.BaseTestCase):
|
||||
class RulesTestCase(test_base.BaseTestCase):
|
||||
|
||||
def test_init_basic(self):
|
||||
rules = policy.Rules()
|
||||
@@ -113,7 +113,7 @@ class RulesTestCase(test.BaseTestCase):
|
||||
self.assertEqual(str(rules), exemplar)
|
||||
|
||||
|
||||
class PolicyBaseTestCase(test.BaseTestCase):
|
||||
class PolicyBaseTestCase(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(PolicyBaseTestCase, self).setUp()
|
||||
@@ -262,7 +262,7 @@ class CheckFunctionTestCase(PolicyBaseTestCase):
|
||||
self.fail("enforcer.enforce() failed to raise requested exception")
|
||||
|
||||
|
||||
class FalseCheckTestCase(test.BaseTestCase):
|
||||
class FalseCheckTestCase(test_base.BaseTestCase):
|
||||
def test_str(self):
|
||||
check = policy.FalseCheck()
|
||||
|
||||
@@ -274,7 +274,7 @@ class FalseCheckTestCase(test.BaseTestCase):
|
||||
self.assertEqual(check('target', 'creds', None), False)
|
||||
|
||||
|
||||
class TrueCheckTestCase(test.BaseTestCase):
|
||||
class TrueCheckTestCase(test_base.BaseTestCase):
|
||||
def test_str(self):
|
||||
check = policy.TrueCheck()
|
||||
|
||||
@@ -291,7 +291,7 @@ class CheckForTest(policy.Check):
|
||||
pass
|
||||
|
||||
|
||||
class CheckTestCase(test.BaseTestCase):
|
||||
class CheckTestCase(test_base.BaseTestCase):
|
||||
def test_init(self):
|
||||
check = CheckForTest('kind', 'match')
|
||||
|
||||
@@ -304,7 +304,7 @@ class CheckTestCase(test.BaseTestCase):
|
||||
self.assertEqual(str(check), 'kind:match')
|
||||
|
||||
|
||||
class NotCheckTestCase(test.BaseTestCase):
|
||||
class NotCheckTestCase(test_base.BaseTestCase):
|
||||
def test_init(self):
|
||||
check = policy.NotCheck('rule')
|
||||
|
||||
@@ -330,7 +330,7 @@ class NotCheckTestCase(test.BaseTestCase):
|
||||
rule.assert_called_once_with('target', 'cred', None)
|
||||
|
||||
|
||||
class AndCheckTestCase(test.BaseTestCase):
|
||||
class AndCheckTestCase(test_base.BaseTestCase):
|
||||
def test_init(self):
|
||||
check = policy.AndCheck(['rule1', 'rule2'])
|
||||
|
||||
@@ -372,7 +372,7 @@ class AndCheckTestCase(test.BaseTestCase):
|
||||
self.assertFalse(rules[1].called)
|
||||
|
||||
|
||||
class OrCheckTestCase(test.BaseTestCase):
|
||||
class OrCheckTestCase(test_base.BaseTestCase):
|
||||
def test_init(self):
|
||||
check = policy.OrCheck(['rule1', 'rule2'])
|
||||
|
||||
@@ -414,7 +414,7 @@ class OrCheckTestCase(test.BaseTestCase):
|
||||
rules[1].assert_called_once_with('target', 'cred', None)
|
||||
|
||||
|
||||
class ParseCheckTestCase(test.BaseTestCase):
|
||||
class ParseCheckTestCase(test_base.BaseTestCase):
|
||||
def test_false(self):
|
||||
result = policy._parse_check('!')
|
||||
|
||||
@@ -457,7 +457,7 @@ class ParseCheckTestCase(test.BaseTestCase):
|
||||
policy._checks[None].assert_called_once_with('spam', 'handler')
|
||||
|
||||
|
||||
class ParseListRuleTestCase(test.BaseTestCase):
|
||||
class ParseListRuleTestCase(test_base.BaseTestCase):
|
||||
def test_empty(self):
|
||||
result = policy._parse_list_rule([])
|
||||
|
||||
@@ -527,7 +527,7 @@ class ParseListRuleTestCase(test.BaseTestCase):
|
||||
'((rule1 and rule2) or (rule3 and rule4))')
|
||||
|
||||
|
||||
class ParseTokenizeTestCase(test.BaseTestCase):
|
||||
class ParseTokenizeTestCase(test_base.BaseTestCase):
|
||||
@mock.patch.object(policy, '_parse_check', lambda x: x)
|
||||
def test_tokenize(self):
|
||||
exemplar = ("(( ( ((() And)) or ) (check:%(miss)s) not)) "
|
||||
@@ -547,7 +547,7 @@ class ParseTokenizeTestCase(test.BaseTestCase):
|
||||
self.assertEqual(result, expected)
|
||||
|
||||
|
||||
class ParseStateMetaTestCase(test.BaseTestCase):
|
||||
class ParseStateMetaTestCase(test_base.BaseTestCase):
|
||||
def test_reducer(self):
|
||||
@policy.reducer('a', 'b', 'c')
|
||||
@policy.reducer('d', 'e', 'f')
|
||||
@@ -581,7 +581,7 @@ class ParseStateMetaTestCase(test.BaseTestCase):
|
||||
self.fail("Unrecognized reducer discovered")
|
||||
|
||||
|
||||
class ParseStateTestCase(test.BaseTestCase):
|
||||
class ParseStateTestCase(test_base.BaseTestCase):
|
||||
def test_init(self):
|
||||
state = policy.ParseState()
|
||||
|
||||
@@ -746,7 +746,7 @@ class ParseStateTestCase(test.BaseTestCase):
|
||||
self.assertEqual(result, [('check', 'not check')])
|
||||
|
||||
|
||||
class ParseTextRuleTestCase(test.BaseTestCase):
|
||||
class ParseTextRuleTestCase(test_base.BaseTestCase):
|
||||
def test_empty(self):
|
||||
result = policy._parse_text_rule('')
|
||||
|
||||
@@ -772,7 +772,7 @@ class ParseTextRuleTestCase(test.BaseTestCase):
|
||||
mock_parse_tokenize.assert_called_once_with('test rule')
|
||||
|
||||
|
||||
class ParseRuleTestCase(test.BaseTestCase):
|
||||
class ParseRuleTestCase(test_base.BaseTestCase):
|
||||
@mock.patch.object(policy, '_parse_text_rule', return_value='text rule')
|
||||
@mock.patch.object(policy, '_parse_list_rule', return_value='list rule')
|
||||
def test_parse_rule_string(self, mock_parse_list_rule,
|
||||
@@ -793,7 +793,7 @@ class ParseRuleTestCase(test.BaseTestCase):
|
||||
mock_parse_list_rule.assert_called_once_with([['a'], ['list']])
|
||||
|
||||
|
||||
class CheckRegisterTestCase(test.BaseTestCase):
|
||||
class CheckRegisterTestCase(test_base.BaseTestCase):
|
||||
@mock.patch.object(policy, '_checks', {})
|
||||
def test_register_check(self):
|
||||
class TestCheck(policy.Check):
|
||||
@@ -812,7 +812,7 @@ class CheckRegisterTestCase(test.BaseTestCase):
|
||||
self.assertEqual(policy._checks, dict(spam=TestCheck))
|
||||
|
||||
|
||||
class RuleCheckTestCase(test.BaseTestCase):
|
||||
class RuleCheckTestCase(test_base.BaseTestCase):
|
||||
@mock.patch.object(ENFORCER, 'rules', {})
|
||||
def test_rule_missing(self):
|
||||
check = policy.RuleCheck('rule', 'spam')
|
||||
|
||||
@@ -20,13 +20,13 @@ import os
|
||||
import tempfile
|
||||
|
||||
import fixtures
|
||||
from oslotest import base as test_base
|
||||
import six
|
||||
|
||||
from openstack.common import processutils
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class UtilsTest(test.BaseTestCase):
|
||||
class UtilsTest(test_base.BaseTestCase):
|
||||
# NOTE(jkoelker) Moar tests from nova need to be ported. But they
|
||||
# need to be mock'd out. Currently they requre actually
|
||||
# running code.
|
||||
@@ -36,7 +36,7 @@ class UtilsTest(test.BaseTestCase):
|
||||
hozer=True)
|
||||
|
||||
|
||||
class ProcessExecutionErrorTest(test.BaseTestCase):
|
||||
class ProcessExecutionErrorTest(test_base.BaseTestCase):
|
||||
|
||||
def test_defaults(self):
|
||||
err = processutils.ProcessExecutionError()
|
||||
@@ -211,7 +211,7 @@ def fake_execute_raises(*cmd, **kwargs):
|
||||
'command'])
|
||||
|
||||
|
||||
class TryCmdTestCase(test.BaseTestCase):
|
||||
class TryCmdTestCase(test_base.BaseTestCase):
|
||||
def test_keep_warnings(self):
|
||||
self.useFixture(fixtures.MonkeyPatch(
|
||||
'openstack.common.processutils.execute', fake_execute))
|
||||
@@ -261,7 +261,7 @@ class FakeSshConnection(object):
|
||||
six.StringIO('stderr'))
|
||||
|
||||
|
||||
class SshExecuteTestCase(test.BaseTestCase):
|
||||
class SshExecuteTestCase(test_base.BaseTestCase):
|
||||
def test_invalid_addl_env(self):
|
||||
self.assertRaises(processutils.InvalidArgumentError,
|
||||
processutils.ssh_execute,
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
import datetime
|
||||
|
||||
import mock
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common.fixture import config
|
||||
from openstack.common.fixture import moxstubout
|
||||
from openstack.common import quota
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class FakeContext(object):
|
||||
@@ -30,7 +30,7 @@ class FakeContext(object):
|
||||
return self
|
||||
|
||||
|
||||
class ExceptionTestCase(test.BaseTestCase):
|
||||
class ExceptionTestCase(test_base.BaseTestCase):
|
||||
|
||||
def _get_raised_exception(self, exception, *args, **kwargs):
|
||||
try:
|
||||
@@ -53,7 +53,7 @@ class ExceptionTestCase(test.BaseTestCase):
|
||||
self.assertEqual(str(e), e.msg_fmt % {"string": "test"})
|
||||
|
||||
|
||||
class DbQuotaDriverTestCase(test.BaseTestCase):
|
||||
class DbQuotaDriverTestCase(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.stubs = self.useFixture(moxstubout.MoxStubout()).stubs
|
||||
@@ -305,7 +305,7 @@ class DbQuotaDriverTestCase(test.BaseTestCase):
|
||||
self.driver.db.reservation_expire.assert_called_once_with(self.ctxt)
|
||||
|
||||
|
||||
class BaseResourceTestCase(test.BaseTestCase):
|
||||
class BaseResourceTestCase(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.ctxt = FakeContext()
|
||||
@@ -344,7 +344,7 @@ class BaseResourceTestCase(test.BaseTestCase):
|
||||
self.assertEqual(1, resource.quota(self.driver, self.ctxt))
|
||||
|
||||
|
||||
class CountableResourceTestCase(test.BaseTestCase):
|
||||
class CountableResourceTestCase(test_base.BaseTestCase):
|
||||
|
||||
def test_init(self):
|
||||
resource = quota.CountableResource('r1', 42)
|
||||
@@ -352,7 +352,7 @@ class CountableResourceTestCase(test.BaseTestCase):
|
||||
self.assertEqual(42, resource.count)
|
||||
|
||||
|
||||
class QuotaEngineTestCase(test.BaseTestCase):
|
||||
class QuotaEngineTestCase(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.ctxt = FakeContext()
|
||||
|
||||
@@ -14,12 +14,12 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common import request_utils
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class RequestUtilsTestCase(test.BaseTestCase):
|
||||
class RequestUtilsTestCase(test_base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(RequestUtilsTestCase, self).setUp()
|
||||
self.notifier = mock.MagicMock()
|
||||
|
||||
@@ -32,6 +32,7 @@ import eventlet
|
||||
from eventlet import event
|
||||
import mock
|
||||
import mox
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common import eventlet_backdoor
|
||||
from openstack.common.fixture import config
|
||||
@@ -39,7 +40,6 @@ from openstack.common.fixture import moxstubout
|
||||
from openstack.common import log as logging
|
||||
from openstack.common.notifier import api as notifier_api
|
||||
from openstack.common import service
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@@ -50,7 +50,7 @@ class ExtendedService(service.Service):
|
||||
return 'service'
|
||||
|
||||
|
||||
class ServiceManagerTestCase(test.BaseTestCase):
|
||||
class ServiceManagerTestCase(test_base.BaseTestCase):
|
||||
"""Test cases for Services."""
|
||||
def test_override_manager_method(self):
|
||||
serv = ExtendedService()
|
||||
@@ -68,7 +68,7 @@ class ServiceWithTimer(service.Service):
|
||||
self.timer_fired = self.timer_fired + 1
|
||||
|
||||
|
||||
class ServiceTestBase(test.BaseTestCase):
|
||||
class ServiceTestBase(test_base.BaseTestCase):
|
||||
"""A base class for ServiceLauncherTest and ServiceRestartTest."""
|
||||
|
||||
def _wait(self, cond, timeout):
|
||||
@@ -285,7 +285,7 @@ class _Service(service.Service):
|
||||
super(_Service, self).stop()
|
||||
|
||||
|
||||
class LauncherTest(test.BaseTestCase):
|
||||
class LauncherTest(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(LauncherTest, self).setUp()
|
||||
|
||||
@@ -14,11 +14,12 @@
|
||||
|
||||
import ssl
|
||||
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common import sslutils
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class SSLUtilsTest(test.BaseTestCase):
|
||||
class SSLUtilsTest(test_base.BaseTestCase):
|
||||
def test_valid_versions(self):
|
||||
self.assertEqual(sslutils.validate_ssl_version("SSLv3"),
|
||||
ssl.PROTOCOL_SSLv3)
|
||||
|
||||
@@ -18,17 +18,17 @@
|
||||
import math
|
||||
|
||||
import mock
|
||||
from oslotest import base as test_base
|
||||
import six
|
||||
import testscenarios
|
||||
|
||||
from openstack.common import strutils
|
||||
from openstack.common import test
|
||||
from openstack.common import units
|
||||
|
||||
load_tests = testscenarios.load_tests_apply_scenarios
|
||||
|
||||
|
||||
class StrUtilsTest(test.BaseTestCase):
|
||||
class StrUtilsTest(test_base.BaseTestCase):
|
||||
|
||||
def test_bool_bool_from_string(self):
|
||||
self.assertTrue(strutils.bool_from_string(True))
|
||||
@@ -201,7 +201,7 @@ class StrUtilsTest(test.BaseTestCase):
|
||||
to_slug("\x80strange", errors="ignore"))
|
||||
|
||||
|
||||
class StringToBytesTest(test.BaseTestCase):
|
||||
class StringToBytesTest(test_base.BaseTestCase):
|
||||
|
||||
_unit_system = [
|
||||
('si', dict(unit_system='SI')),
|
||||
|
||||
@@ -15,12 +15,13 @@
|
||||
import os
|
||||
import socket
|
||||
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common.fixture import moxstubout
|
||||
from openstack.common import systemd
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class SystemdTestCase(test.BaseTestCase):
|
||||
class SystemdTestCase(test_base.BaseTestCase):
|
||||
"""Test case for Systemd service readiness."""
|
||||
def setUp(self):
|
||||
super(SystemdTestCase, self).setUp()
|
||||
|
||||
@@ -17,11 +17,12 @@
|
||||
Unit Tests for thread groups
|
||||
"""
|
||||
|
||||
from openstack.common import test
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common import threadgroup
|
||||
|
||||
|
||||
class ThreadGroupTestCase(test.BaseTestCase):
|
||||
class ThreadGroupTestCase(test_base.BaseTestCase):
|
||||
"""Test cases for thread group."""
|
||||
def setUp(self):
|
||||
super(ThreadGroupTestCase, self).setUp()
|
||||
|
||||
@@ -19,13 +19,13 @@ import time
|
||||
|
||||
import iso8601
|
||||
import mock
|
||||
from oslotest import base as test_base
|
||||
from testtools import matchers
|
||||
|
||||
from openstack.common import test
|
||||
from openstack.common import timeutils
|
||||
|
||||
|
||||
class TimeUtilsTest(test.BaseTestCase):
|
||||
class TimeUtilsTest(test_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TimeUtilsTest, self).setUp()
|
||||
@@ -215,7 +215,7 @@ class TimeUtilsTest(test.BaseTestCase):
|
||||
self.assertTrue(timeutils.is_soon(expires, 0))
|
||||
|
||||
|
||||
class TestIso8601Time(test.BaseTestCase):
|
||||
class TestIso8601Time(test_base.BaseTestCase):
|
||||
|
||||
def _instaneous(self, timestamp, yr, mon, day, hr, minute, sec, micro):
|
||||
self.assertEqual(timestamp.year, yr)
|
||||
|
||||
@@ -13,11 +13,12 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from openstack.common import test
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common import units
|
||||
|
||||
|
||||
class UnitTest(test.BaseTestCase):
|
||||
class UnitTest(test_base.BaseTestCase):
|
||||
def test_binary_unit(self):
|
||||
self.assertEqual(units.Ki, 1024)
|
||||
self.assertEqual(units.Mi, 1024 ** 2)
|
||||
|
||||
@@ -15,11 +15,12 @@
|
||||
|
||||
import uuid
|
||||
|
||||
from openstack.common import test
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common import uuidutils
|
||||
|
||||
|
||||
class UUIDUtilsTest(test.BaseTestCase):
|
||||
class UUIDUtilsTest(test_base.BaseTestCase):
|
||||
|
||||
def test_generate_uuid(self):
|
||||
uuid_string = uuidutils.generate_uuid()
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from oslotest import base as test_base
|
||||
from testtools import matchers
|
||||
|
||||
from openstack.common import test
|
||||
from openstack.common import versionutils
|
||||
|
||||
|
||||
class DeprecatedTestCase(test.BaseTestCase):
|
||||
class DeprecatedTestCase(test_base.BaseTestCase):
|
||||
def assert_deprecated(self, mock_log, **expected_details):
|
||||
decorator = versionutils.deprecated
|
||||
if 'in_favor_of' in expected_details:
|
||||
@@ -147,7 +147,7 @@ class DeprecatedTestCase(test.BaseTestCase):
|
||||
remove_in='J')
|
||||
|
||||
|
||||
class IsCompatibleTestCase(test.BaseTestCase):
|
||||
class IsCompatibleTestCase(test_base.BaseTestCase):
|
||||
def test_same_version(self):
|
||||
self.assertTrue(versionutils.is_compatible('1', '1'))
|
||||
self.assertTrue(versionutils.is_compatible('1.0', '1.0'))
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslotest import base as test_base
|
||||
from xml.dom import minidom
|
||||
|
||||
from openstack.common import test
|
||||
from openstack.common import xmlutils
|
||||
|
||||
|
||||
class XMLUtilsTestCase(test.BaseTestCase):
|
||||
class XMLUtilsTestCase(test_base.BaseTestCase):
|
||||
def test_safe_parse_xml(self):
|
||||
|
||||
normal_body = ("""
|
||||
@@ -53,7 +53,7 @@ class XMLUtilsTestCase(test.BaseTestCase):
|
||||
killer_body())
|
||||
|
||||
|
||||
class SafeParserTestCase(test.BaseTestCase):
|
||||
class SafeParserTestCase(test_base.BaseTestCase):
|
||||
def test_external_dtd(self):
|
||||
xml_string = ("""<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
|
||||
@@ -14,12 +14,12 @@
|
||||
# under the License.
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslotest import base as test_base
|
||||
|
||||
from openstack.common.fixture import moxstubout
|
||||
from openstack.common import test
|
||||
|
||||
|
||||
class BaseTestCase(test.BaseTestCase):
|
||||
class BaseTestCase(test_base.BaseTestCase):
|
||||
def setUp(self, conf=cfg.CONF):
|
||||
super(BaseTestCase, self).setUp()
|
||||
moxfixture = self.useFixture(moxstubout.MoxStubout())
|
||||
|
||||
Reference in New Issue
Block a user