Use mock storage for MQTT tests (#33553)
* mock storage for MQTT * more mqtt storage mocks
This commit is contained in:
1 parent
36a606f81d
commit
201e958854
4 files changed
+19
-1
No files matched your search
@@ -33,6 +33,7 @@ from tests.common import (
|
||||
mock_device_registry,
|
||||
mock_mqtt_component,
|
||||
mock_registry,
|
||||
mock_storage,
|
||||
threadsafe_coroutine_factory,
|
||||
)
|
||||
|
||||
@@ -83,12 +84,15 @@ class TestMQTTComponent(unittest.TestCase):
|
||||
def setUp(self): # pylint: disable=invalid-name
|
||||
"""Set up things to be run when tests are started."""
|
||||
self.hass = get_test_home_assistant()
|
||||
self.mock_storage = mock_storage()
|
||||
self.mock_storage.__enter__()
|
||||
mock_mqtt_component(self.hass)
|
||||
self.calls = []
|
||||
|
||||
def tearDown(self): # pylint: disable=invalid-name
|
||||
"""Stop everything that was started."""
|
||||
self.hass.stop()
|
||||
self.mock_storage.__exit__(None, None, None)
|
||||
|
||||
@callback
|
||||
def record_calls(self, *args):
|
||||
@@ -298,12 +302,15 @@ class TestMQTTCallbacks(unittest.TestCase):
|
||||
def setUp(self): # pylint: disable=invalid-name
|
||||
"""Set up things to be run when tests are started."""
|
||||
self.hass = get_test_home_assistant()
|
||||
self.mock_storage = mock_storage()
|
||||
self.mock_storage.__enter__()
|
||||
mock_mqtt_client(self.hass)
|
||||
self.calls = []
|
||||
|
||||
def tearDown(self): # pylint: disable=invalid-name
|
||||
"""Stop everything that was started."""
|
||||
self.hass.stop()
|
||||
self.mock_storage.__exit__(None, None, None)
|
||||
|
||||
@callback
|
||||
def record_calls(self, *args):
|
||||
|
||||
Reference in new issue
Block a user