Merge "Clean up test imports"

This commit is contained in:
Zuul 2023-05-11 02:31:36 +00:00 committed by Gerrit Code Review
commit f46c802523
15 changed files with 31 additions and 95 deletions

View File

@ -1,20 +0,0 @@
# Copyright 2012 Managed I.T.
#
# Author: Kiall Mac Innes <kiall@managedit.ie>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from designate.tests import TestCase
class ApiTestCase(TestCase):
pass

View File

@ -20,7 +20,7 @@ from webtest import TestApp
from designate.api import admin as admin_api
from designate.api import middleware
from designate.tests.test_api import ApiTestCase
import designate.tests
LOG = logging.getLogger(__name__)
@ -33,7 +33,7 @@ INVALID_ID = [
]
class AdminApiTestCase(ApiTestCase):
class AdminApiTestCase(designate.tests.TestCase):
def setUp(self):
super(AdminApiTestCase, self).setUp()

View File

@ -23,7 +23,7 @@ from designate.api import middleware
from designate import context
from designate import exceptions
from designate import rpc
from designate.tests.test_api import ApiTestCase
import designate.tests
class FakeRequest(object):
@ -43,7 +43,7 @@ class FakeRequest(object):
return "FakeResponse"
class KeystoneContextMiddlewareTest(ApiTestCase):
class KeystoneContextMiddlewareTest(designate.tests.TestCase):
def test_process_request(self):
app = middleware.KeystoneContextMiddleware({})
@ -106,7 +106,7 @@ class KeystoneContextMiddlewareTest(ApiTestCase):
self.assertEqual(response, 'FakeResponse')
class NoAuthContextMiddlewareTest(ApiTestCase):
class NoAuthContextMiddlewareTest(designate.tests.TestCase):
def test_process_request(self):
app = middleware.NoAuthContextMiddleware({})
@ -125,7 +125,7 @@ class NoAuthContextMiddlewareTest(ApiTestCase):
self.assertEqual(['admin'], ctxt.roles)
class MaintenanceMiddlewareTest(ApiTestCase):
class MaintenanceMiddlewareTest(designate.tests.TestCase):
def test_process_request_disabled(self):
self.config(maintenance_mode=False, group='service:api')
@ -197,7 +197,7 @@ class MaintenanceMiddlewareTest(ApiTestCase):
self.assertEqual('FakeResponse', response)
class NormalizeURIMiddlewareTest(ApiTestCase):
class NormalizeURIMiddlewareTest(designate.tests.TestCase):
def test_strip_trailing_slases(self):
request = FakeRequest()
request.environ['PATH_INFO'] = 'resource/'
@ -223,7 +223,7 @@ class NormalizeURIMiddlewareTest(ApiTestCase):
self.assertEqual('resource', request.environ['PATH_INFO'])
class FaultMiddlewareTest(ApiTestCase):
class FaultMiddlewareTest(designate.tests.TestCase):
@mock.patch.object(notifier.Notifier, "error")
def test_notify_of_fault(self, mock_notifier):
self.config(notify_api_faults=True)

View File

@ -20,10 +20,10 @@ from paste import urlmap
from designate.api import service
from designate import exceptions
from designate.tests.test_api import ApiTestCase
import designate.tests
class ApiServiceTest(ApiTestCase):
class ApiServiceTest(designate.tests.TestCase):
def setUp(self):
super(ApiServiceTest, self).setUp()

View File

@ -20,7 +20,7 @@ from webtest import TestApp
from designate.api import middleware
from designate.api import v2 as api_v2
from designate.tests.test_api import ApiTestCase
import designate.tests
LOG = logging.getLogger(__name__)
@ -33,7 +33,7 @@ INVALID_ID = [
]
class ApiV2TestCase(ApiTestCase):
class ApiV2TestCase(designate.tests.TestCase):
def setUp(self):
super(ApiV2TestCase, self).setUp()

View File

@ -1,20 +0,0 @@
# Copyright 2012 Managed I.T.
#
# Author: Kiall Mac Innes <kiall@managedit.ie>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from designate.tests import TestCase
class CentralTestCase(TestCase):
pass

View File

@ -39,15 +39,15 @@ from designate import exceptions
from designate import objects
from designate.storage.impl_sqlalchemy import tables
from designate.storage import sql
import designate.tests
from designate.tests import fixtures
from designate.tests.test_central import CentralTestCase
from designate import utils
from designate.worker import rpcapi as worker_api
LOG = logging.getLogger(__name__)
class CentralServiceTest(CentralTestCase):
class CentralServiceTest(designate.tests.TestCase):
def setUp(self):
super(CentralServiceTest, self).setUp()
self.stdlog = fixtures.StandardLogging()

View File

@ -1,5 +0,0 @@
from designate.tests import TestCase
class DesignateManageTestCase(TestCase):
pass

View File

@ -15,14 +15,14 @@ from io import StringIO
from unittest import mock
from designate.manage import database
from designate import tests as designate_tests
import designate.tests
class TestManageDatabase(designate_tests.TestCase):
class TestManageDatabase(designate.tests.TestCase):
def setUp(self):
super(TestManageDatabase, self).setUp()
self.stdlog = designate_tests.fixtures.StandardLogging()
self.stdlog = designate.tests.fixtures.StandardLogging()
self.useFixture(self.stdlog)
self.db_cmds = database.DatabaseCommands()

View File

@ -20,9 +20,9 @@ import oslo_messaging
from designate.central import service
from designate.manage import base
from designate.manage import pool
import designate.tests
from designate.tests import fixtures
from designate.tests import resources
from designate.tests.test_manage import DesignateManageTestCase
LOG = logging.getLogger(__name__)
@ -36,9 +36,9 @@ def get_pools(name='pools.yaml'):
return yaml.safe_load(pool_obj)
class ManagePoolTestCase(DesignateManageTestCase):
class ManagePoolTestCase(designate.tests.TestCase):
def setUp(self):
super(DesignateManageTestCase, self).setUp()
super(ManagePoolTestCase, self).setUp()
self.stdlog = fixtures.StandardLogging()
self.useFixture(self.stdlog)

View File

@ -17,8 +17,8 @@ from oslo_log import log as logging
from designate.manage import base
from designate.manage import pool
from designate import objects
import designate.tests
from designate.tests import fixtures
from designate.tests.test_manage import DesignateManageTestCase
LOG = logging.getLogger(__name__)
@ -34,9 +34,9 @@ def hydrate_pool_targets(target_masters):
return pool_targets
class UpdatePoolTestCase(DesignateManageTestCase):
class UpdatePoolTestCase(designate.tests.TestCase):
def setUp(self):
super(DesignateManageTestCase, self).setUp()
super(UpdatePoolTestCase, self).setUp()
self.stdlog = fixtures.StandardLogging()
self.useFixture(self.stdlog)

View File

@ -1,20 +0,0 @@
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# Author: Kiall Mac Innes <kiall@hpe.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from designate.tests import TestCase
class MdnsTestCase(TestCase):
pass

View File

@ -28,7 +28,7 @@ import testtools
from designate import context
from designate.mdns import handler
from designate import objects
from designate.tests.test_mdns import MdnsTestCase
import designate.tests
CONF = cfg.CONF
default_pool_id = CONF['service:central'].default_pool_id
@ -49,7 +49,7 @@ ANSWER = [
]
class MdnsRequestHandlerTest(MdnsTestCase):
class MdnsRequestHandlerTest(designate.tests.TestCase):
def setUp(self):
super(MdnsRequestHandlerTest, self).setUp()
self.mock_tg = mock.Mock()

View File

@ -24,7 +24,7 @@ import dns
import dns.message
from oslo_log import log as logging
from designate.tests.test_mdns import MdnsTestCase
import designate.tests
LOG = logging.getLogger(__name__)
@ -33,7 +33,7 @@ def hex_wire(response):
return binascii.b2a_hex(response.to_wire())
class MdnsServiceTest(MdnsTestCase):
class MdnsServiceTest(designate.tests.TestCase):
# DNS packet with IQUERY opcode
query_payload = binascii.a2b_hex(
"271209000001000000000000076578616d706c6503636f6d0000010001"

View File

@ -17,16 +17,17 @@ from unittest import mock
from oslo_config import cfg
from oslo_log import log as logging
from testscenarios import load_tests_apply_scenarios as load_tests # noqa
import testscenarios
from designate import exceptions
from designate import quota
from designate import tests
import designate.tests
LOG = logging.getLogger(__name__)
load_tests = testscenarios.load_tests_apply_scenarios
class QuotaTestCase(tests.TestCase):
class QuotaTestCase(designate.tests.TestCase):
scenarios = [
('noop', dict(quota_driver='noop')),
('storage', dict(quota_driver='storage'))