init home-assistant
This commit is contained in:
29
home-assistant/tests/components/thread/test_init.py
Normal file
29
home-assistant/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) -> None:
|
||||
"""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) -> None:
|
||||
"""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
|
||||
Reference in New Issue
Block a user