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
@@ -7,7 +7,7 @@ import homeassistant.components.mqtt as mqtt
|
||||
from homeassistant.const import CONF_PASSWORD
|
||||
from homeassistant.setup import setup_component
|
||||
|
||||
from tests.common import get_test_home_assistant, mock_coro
|
||||
from tests.common import get_test_home_assistant, mock_coro, mock_storage
|
||||
|
||||
|
||||
class TestMQTT:
|
||||
@@ -16,10 +16,13 @@ class TestMQTT:
|
||||
def setup_method(self, method):
|
||||
"""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__()
|
||||
|
||||
def teardown_method(self, method):
|
||||
"""Stop everything that was started."""
|
||||
self.hass.stop()
|
||||
self.mock_storage.__exit__(None, None, None)
|
||||
|
||||
@patch("passlib.apps.custom_app_context", Mock(return_value=""))
|
||||
@patch("tempfile.NamedTemporaryFile", Mock(return_value=MagicMock()))
|
||||
|
||||
Reference in new issue
Block a user