Add Thread integration (#86283)
* Add Thread integration * Address review comments * Address review comments
This commit is contained in:
parent
c15f4ad648
commit
9ef86b7b66
12 changed files with 152 additions and 0 deletions
29
tests/components/thread/test_init.py
Normal file
29
tests/components/thread/test_init.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
"""Test the Thread integration."""
|
||||
|
||||
from homeassistant.components import thread
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
|
||||
async def test_create_entry(hass: HomeAssistant):
|
||||
"""Test an entry is created by async_setup."""
|
||||
assert len(hass.config_entries.async_entries(thread.DOMAIN)) == 0
|
||||
assert await async_setup_component(hass, thread.DOMAIN, {})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert len(hass.config_entries.async_entries(thread.DOMAIN)) == 1
|
||||
|
||||
|
||||
async def test_remove_entry(hass: HomeAssistant, thread_config_entry):
|
||||
"""Test removing the entry."""
|
||||
|
||||
config_entry = hass.config_entries.async_entries(thread.DOMAIN)[0]
|
||||
assert await hass.config_entries.async_remove(config_entry.entry_id) == {
|
||||
"require_restart": False
|
||||
}
|
||||
|
||||
|
||||
async def test_import_once(hass: HomeAssistant, thread_config_entry) -> None:
|
||||
"""Test only a single entry is created."""
|
||||
await hass.async_block_till_done()
|
||||
assert len(hass.config_entries.async_entries(thread.DOMAIN)) == 1
|
Loading…
Add table
Add a link
Reference in a new issue