Inline MQTT paho imports (#29177)

* Inline MQTT paho imports

* Address comments

* Fix patch paths

* Move other imports inline

* Fix test
This commit is contained in:
Paulus Schoutsen 2019-12-02 11:32:02 -08:00 committed by GitHub
parent 1804c6edc5
commit ffaa0e572a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 17 deletions

View file

@ -19,13 +19,9 @@ class TestMQTT:
"""Stop everything that was started."""
self.hass.stop()
@patch(
"homeassistant.components.mqtt.server.custom_app_context", Mock(return_value="")
)
@patch("passlib.apps.custom_app_context", Mock(return_value=""))
@patch("tempfile.NamedTemporaryFile", Mock(return_value=MagicMock()))
@patch(
"homeassistant.components.mqtt.server.Broker", Mock(return_value=MagicMock())
)
@patch("hbmqtt.broker.Broker", Mock(return_value=MagicMock()))
@patch("hbmqtt.broker.Broker.start", Mock(return_value=mock_coro()))
@patch("homeassistant.components.mqtt.MQTT")
def test_creating_config_with_pass_and_no_http_pass(self, mock_mqtt):
@ -45,13 +41,9 @@ class TestMQTT:
assert mock_mqtt.mock_calls[1][2]["username"] == "homeassistant"
assert mock_mqtt.mock_calls[1][2]["password"] == password
@patch(
"homeassistant.components.mqtt.server.custom_app_context", Mock(return_value="")
)
@patch("passlib.apps.custom_app_context", Mock(return_value=""))
@patch("tempfile.NamedTemporaryFile", Mock(return_value=MagicMock()))
@patch(
"homeassistant.components.mqtt.server.Broker", Mock(return_value=MagicMock())
)
@patch("hbmqtt.broker.Broker", Mock(return_value=MagicMock()))
@patch("hbmqtt.broker.Broker.start", Mock(return_value=mock_coro()))
@patch("homeassistant.components.mqtt.MQTT")
def test_creating_config_with_pass_and_http_pass(self, mock_mqtt):