Ensure coverage mqtt entry disabled test (#101617)
This commit is contained in:
parent
3bbef476ee
commit
74464fd94e
1 changed files with 15 additions and 8 deletions
|
@ -3545,15 +3545,16 @@ async def test_publish_or_subscribe_without_valid_config_entry(
|
|||
await mqtt.async_subscribe(hass, "some-topic", record_calls, qos=0)
|
||||
|
||||
|
||||
@patch("homeassistant.components.mqtt.PLATFORMS", [Platform.LIGHT])
|
||||
@patch(
|
||||
"homeassistant.components.mqtt.PLATFORMS",
|
||||
["tag", Platform.LIGHT],
|
||||
)
|
||||
@pytest.mark.parametrize(
|
||||
"hass_config",
|
||||
[
|
||||
{
|
||||
"mqtt": {
|
||||
"light": [
|
||||
{"name": "test_new_modern", "command_topic": "test-topic_new"}
|
||||
]
|
||||
"light": [{"name": "test", "command_topic": "test-topic"}],
|
||||
}
|
||||
}
|
||||
],
|
||||
|
@ -3567,9 +3568,11 @@ async def test_disabling_and_enabling_entry(
|
|||
await mqtt_mock_entry()
|
||||
entry = hass.config_entries.async_entries(mqtt.DOMAIN)[0]
|
||||
assert entry.state is ConfigEntryState.LOADED
|
||||
# Late discovery of a light
|
||||
config = '{"name": "abc", "command_topic": "test-topic"}'
|
||||
async_fire_mqtt_message(hass, "homeassistant/light/abc/config", config)
|
||||
# Late discovery of a mqtt entity/tag
|
||||
config_tag = '{"topic": "0AFFD2/tag_scanned", "value_template": "{{ value_json.PN532.UID }}"}'
|
||||
config_light = '{"name": "test2", "command_topic": "test-topic_new"}'
|
||||
async_fire_mqtt_message(hass, "homeassistant/tag/abc/config", config_tag)
|
||||
async_fire_mqtt_message(hass, "homeassistant/light/abc/config", config_light)
|
||||
|
||||
# Disable MQTT config entry
|
||||
await hass.config_entries.async_set_disabled_by(
|
||||
|
@ -3578,6 +3581,10 @@ async def test_disabling_and_enabling_entry(
|
|||
|
||||
await hass.async_block_till_done()
|
||||
await hass.async_block_till_done()
|
||||
assert (
|
||||
"MQTT integration is disabled, skipping setup of discovered item MQTT tag"
|
||||
in caplog.text
|
||||
)
|
||||
assert (
|
||||
"MQTT integration is disabled, skipping setup of discovered item MQTT light"
|
||||
in caplog.text
|
||||
|
@ -3593,7 +3600,7 @@ async def test_disabling_and_enabling_entry(
|
|||
new_mqtt_config_entry = entry
|
||||
assert new_mqtt_config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
assert hass.states.get("light.test_new_modern") is not None
|
||||
assert hass.states.get("light.test") is not None
|
||||
|
||||
|
||||
@patch("homeassistant.components.mqtt.PLATFORMS", [Platform.LIGHT])
|
||||
|
|
Loading…
Add table
Reference in a new issue