Add Thread integration (#86283)

* Add Thread integration

* Address review comments

* Address review comments
This commit is contained in:
Erik Montnemery 2023-01-23 16:27:24 +01:00 committed by GitHub
parent c15f4ad648
commit 9ef86b7b66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 152 additions and 0 deletions

View 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