Clean up test imports

Change-Id: I665f9d3a5bb8ceeace0bdedac2b64c9dc6205668
This commit is contained in:
Erik Olof Gunnar Andersson 2023-05-07 17:21:06 -07:00
parent 118294ac14
commit e7aed84431
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 admin as admin_api
from designate.api import middleware from designate.api import middleware
from designate.tests.test_api import ApiTestCase import designate.tests
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -33,7 +33,7 @@ INVALID_ID = [
] ]
class AdminApiTestCase(ApiTestCase): class AdminApiTestCase(designate.tests.TestCase):
def setUp(self): def setUp(self):
super(AdminApiTestCase, self).setUp() super(AdminApiTestCase, self).setUp()

View File

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

View File

@ -20,10 +20,10 @@ from paste import urlmap
from designate.api import service from designate.api import service
from designate import exceptions 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): def setUp(self):
super(ApiServiceTest, self).setUp() super(ApiServiceTest, self).setUp()

View File

@ -20,7 +20,7 @@ from webtest import TestApp
from designate.api import middleware from designate.api import middleware
from designate.api import v2 as api_v2 from designate.api import v2 as api_v2
from designate.tests.test_api import ApiTestCase import designate.tests
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -33,7 +33,7 @@ INVALID_ID = [
] ]
class ApiV2TestCase(ApiTestCase): class ApiV2TestCase(designate.tests.TestCase):
def setUp(self): def setUp(self):
super(ApiV2TestCase, self).setUp() 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 import objects
from designate.storage.impl_sqlalchemy import tables from designate.storage.impl_sqlalchemy import tables
from designate.storage import sql from designate.storage import sql
import designate.tests
from designate.tests import fixtures from designate.tests import fixtures
from designate.tests.test_central import CentralTestCase
from designate import utils from designate import utils
from designate.worker import rpcapi as worker_api from designate.worker import rpcapi as worker_api
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
class CentralServiceTest(CentralTestCase): class CentralServiceTest(designate.tests.TestCase):
def setUp(self): def setUp(self):
super(CentralServiceTest, self).setUp() super(CentralServiceTest, self).setUp()
self.stdlog = fixtures.StandardLogging() 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 unittest import mock
from designate.manage import database 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): def setUp(self):
super(TestManageDatabase, self).setUp() super(TestManageDatabase, self).setUp()
self.stdlog = designate_tests.fixtures.StandardLogging() self.stdlog = designate.tests.fixtures.StandardLogging()
self.useFixture(self.stdlog) self.useFixture(self.stdlog)
self.db_cmds = database.DatabaseCommands() self.db_cmds = database.DatabaseCommands()

View File

@ -20,9 +20,9 @@ import oslo_messaging
from designate.central import service from designate.central import service
from designate.manage import base from designate.manage import base
from designate.manage import pool from designate.manage import pool
import designate.tests
from designate.tests import fixtures from designate.tests import fixtures
from designate.tests import resources from designate.tests import resources
from designate.tests.test_manage import DesignateManageTestCase
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -36,9 +36,9 @@ def get_pools(name='pools.yaml'):
return yaml.safe_load(pool_obj) return yaml.safe_load(pool_obj)
class ManagePoolTestCase(DesignateManageTestCase): class ManagePoolTestCase(designate.tests.TestCase):
def setUp(self): def setUp(self):
super(DesignateManageTestCase, self).setUp() super(ManagePoolTestCase, self).setUp()
self.stdlog = fixtures.StandardLogging() self.stdlog = fixtures.StandardLogging()
self.useFixture(self.stdlog) 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 base
from designate.manage import pool from designate.manage import pool
from designate import objects from designate import objects
import designate.tests
from designate.tests import fixtures from designate.tests import fixtures
from designate.tests.test_manage import DesignateManageTestCase
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -34,9 +34,9 @@ def hydrate_pool_targets(target_masters):
return pool_targets return pool_targets
class UpdatePoolTestCase(DesignateManageTestCase): class UpdatePoolTestCase(designate.tests.TestCase):
def setUp(self): def setUp(self):
super(DesignateManageTestCase, self).setUp() super(UpdatePoolTestCase, self).setUp()
self.stdlog = fixtures.StandardLogging() self.stdlog = fixtures.StandardLogging()
self.useFixture(self.stdlog) 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 import context
from designate.mdns import handler from designate.mdns import handler
from designate import objects from designate import objects
from designate.tests.test_mdns import MdnsTestCase import designate.tests
CONF = cfg.CONF CONF = cfg.CONF
default_pool_id = CONF['service:central'].default_pool_id 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): def setUp(self):
super(MdnsRequestHandlerTest, self).setUp() super(MdnsRequestHandlerTest, self).setUp()
self.mock_tg = mock.Mock() self.mock_tg = mock.Mock()

View File

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

View File

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