Fix mdns test_handler setup

If the unit tests were run isolated from the larger test suite, the mdns test_handler unit tests would fail with "AssertionError: 'TRANSPORT' must not be None" because the messaging and RPC fixtures were not setup for the test suite.
This patch adds the required test fixtures to the mdns test_handler setUp().

Change-Id: I7edf1e147637b013f35ba47e4d6b92d53d42fe84
This commit is contained in:
Michael Johnson 2022-09-20 23:00:40 +00:00
parent b0bff602ed
commit e6566f8606
1 changed files with 6 additions and 0 deletions

View File

@ -18,6 +18,7 @@ from unittest import mock
import dns
from oslo_config import cfg
from oslo_config import fixture as cfg_fixture
from oslo_messaging import conffixture as messaging_fixture
import oslotest.base
from designate import exceptions
@ -39,6 +40,11 @@ class MdnsHandleTest(oslotest.base.BaseTestCase):
self.storage = mock.Mock()
self.tg = mock.Mock()
self.handler = handler.RequestHandler(self.storage, self.tg)
self.messaging_conf = messaging_fixture.ConfFixture(CONF)
self.messaging_conf.transport_url = 'fake:/'
self.messaging_conf.response_timeout = 5
self.useFixture(self.messaging_conf)
self.useFixture(fixtures.RPCFixture(CONF))
def test_worker_api(self):
self.assertIsNone(self.handler._worker_api)