forked from home-assistant/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reload ESPHome config entries when dashboard info received (home-assi…
- Loading branch information
Showing
10 changed files
with
106 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
"""ESPHome constants.""" | ||
|
||
DOMAIN = "esphome" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters