Don't send MQTT birth message in tests (#43917)
This commit is contained in:
parent
a5279cc279
commit
5e6f5fca90
2 changed files with 13 additions and 1 deletions
|
@ -781,6 +781,18 @@ async def test_custom_birth_message(hass, mqtt_client_mock, mqtt_mock):
|
||||||
mqtt_client_mock.publish.assert_called_with("birth", "birth", 0, False)
|
mqtt_client_mock.publish.assert_called_with("birth", "birth", 0, False)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"mqtt_config",
|
||||||
|
[
|
||||||
|
{
|
||||||
|
mqtt.CONF_BROKER: "mock-broker",
|
||||||
|
mqtt.CONF_BIRTH_MESSAGE: {
|
||||||
|
mqtt.ATTR_TOPIC: "homeassistant/status",
|
||||||
|
mqtt.ATTR_PAYLOAD: "online",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
],
|
||||||
|
)
|
||||||
async def test_default_birth_message(hass, mqtt_client_mock, mqtt_mock):
|
async def test_default_birth_message(hass, mqtt_client_mock, mqtt_mock):
|
||||||
"""Test sending birth message."""
|
"""Test sending birth message."""
|
||||||
birth = asyncio.Event()
|
birth = asyncio.Event()
|
||||||
|
|
|
@ -400,7 +400,7 @@ def mqtt_client_mock(hass):
|
||||||
async def mqtt_mock(hass, mqtt_client_mock, mqtt_config):
|
async def mqtt_mock(hass, mqtt_client_mock, mqtt_config):
|
||||||
"""Fixture to mock MQTT component."""
|
"""Fixture to mock MQTT component."""
|
||||||
if mqtt_config is None:
|
if mqtt_config is None:
|
||||||
mqtt_config = {mqtt.CONF_BROKER: "mock-broker"}
|
mqtt_config = {mqtt.CONF_BROKER: "mock-broker", mqtt.CONF_BIRTH_MESSAGE: {}}
|
||||||
|
|
||||||
result = await async_setup_component(hass, mqtt.DOMAIN, {mqtt.DOMAIN: mqtt_config})
|
result = await async_setup_component(hass, mqtt.DOMAIN, {mqtt.DOMAIN: mqtt_config})
|
||||||
assert result
|
assert result
|
||||||
|
|
Loading…
Add table
Reference in a new issue