Fix mqtt check in ozw (#45709)
This commit is contained in:
parent
b2789621bd
commit
bcc9add0b4
6 changed files with 49 additions and 9 deletions
|
@ -37,6 +37,26 @@ async def test_setup_entry_without_mqtt(hass):
|
|||
assert not await hass.config_entries.async_setup(entry.entry_id)
|
||||
|
||||
|
||||
async def test_publish_without_mqtt(hass, caplog):
|
||||
"""Test publish without mqtt integration setup."""
|
||||
with patch("homeassistant.components.ozw.OZWOptions") as ozw_options:
|
||||
await setup_ozw(hass)
|
||||
|
||||
send_message = ozw_options.call_args[1]["send_message"]
|
||||
|
||||
mqtt_entries = hass.config_entries.async_entries("mqtt")
|
||||
mqtt_entry = mqtt_entries[0]
|
||||
await hass.config_entries.async_remove(mqtt_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert not hass.config_entries.async_entries("mqtt")
|
||||
|
||||
# Sending a message should not error with the MQTT integration not set up.
|
||||
send_message("test_topic", "test_payload")
|
||||
|
||||
assert "MQTT integration is not set up" in caplog.text
|
||||
|
||||
|
||||
async def test_unload_entry(hass, generic_data, switch_msg, caplog):
|
||||
"""Test unload the config entry."""
|
||||
entry = MockConfigEntry(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue