mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Reload ESPHome config entries when dashboard info received (#86174)
This commit is contained in:
22
tests/components/esphome/test_dashboard.py
Normal file
22
tests/components/esphome/test_dashboard.py
Normal file
@@ -0,0 +1,22 @@
|
||||
"""Test ESPHome dashboard features."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.esphome import dashboard
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
|
||||
|
||||
async def test_new_info_reload_config_entries(hass, init_integration, mock_dashboard):
|
||||
"""Test config entries are reloaded when new info is set."""
|
||||
assert init_integration.state == ConfigEntryState.LOADED
|
||||
|
||||
with patch("homeassistant.components.esphome.async_setup_entry") as mock_setup:
|
||||
await dashboard.async_set_dashboard_info(hass, "test-slug", "test-host", 6052)
|
||||
|
||||
assert len(mock_setup.mock_calls) == 1
|
||||
assert mock_setup.mock_calls[0][1][1] == init_integration
|
||||
|
||||
# Test it's a no-op when the same info is set
|
||||
with patch("homeassistant.components.esphome.async_setup_entry") as mock_setup:
|
||||
await dashboard.async_set_dashboard_info(hass, "test-slug", "test-host", 6052)
|
||||
|
||||
assert len(mock_setup.mock_calls) == 0
|
||||
Reference in New Issue
Block a user