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 authored and GitHub committed 2020-06-22 22:02:29 +02:00
1 parent 3a83f4bdbe
commit a2e2c35011
4 files changed
+570 -509

No files matched your search

+4 -1
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"]