1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Use pytest for more MQTT tests (#36859)

* Use pytest for more MQTT tests

* Address review comments

* Break out PAHO client mock in separate fixture.

* tweak.
This commit is contained in:
Erik Montnemery
2020-06-22 22:02:29 +02:00
committed by GitHub
parent 3a83f4bdbe
commit a2e2c35011
4 changed files with 570 additions and 509 deletions

View File

@@ -344,10 +344,13 @@ async def async_mock_mqtt_component(hass, config=None):
assert result
await hass.async_block_till_done()
hass.data["mqtt"] = MagicMock(
mqtt_component_mock = MagicMock(
spec_set=hass.data["mqtt"], wraps=hass.data["mqtt"]
)
hass.data["mqtt"].connected = mqtt_component_mock.connected
mqtt_component_mock._mqttc = mock_client
hass.data["mqtt"] = mqtt_component_mock
return hass.data["mqtt"]