2019-12-31 13:34:53 +00:00
|
|
|
"""Tests for the local_ip component."""
|
|
|
|
from homeassistant.components.local_ip import DOMAIN
|
|
|
|
from homeassistant.util import get_local_ip
|
|
|
|
|
2021-05-15 11:45:10 +00:00
|
|
|
from tests.common import MockConfigEntry
|
2019-12-31 13:34:53 +00:00
|
|
|
|
|
|
|
|
2021-05-15 11:45:10 +00:00
|
|
|
async def test_basic_setup(hass):
|
2019-12-31 13:34:53 +00:00
|
|
|
"""Test component setup creates entry from config."""
|
2021-05-15 11:45:10 +00:00
|
|
|
entry = MockConfigEntry(domain=DOMAIN, data={})
|
|
|
|
entry.add_to_hass(hass)
|
|
|
|
|
|
|
|
await hass.config_entries.async_setup(entry.entry_id)
|
2019-12-31 13:34:53 +00:00
|
|
|
await hass.async_block_till_done()
|
2021-05-15 11:45:10 +00:00
|
|
|
|
2019-12-31 13:34:53 +00:00
|
|
|
local_ip = await hass.async_add_executor_job(get_local_ip)
|
2020-04-09 14:06:01 +00:00
|
|
|
state = hass.states.get(f"sensor.{DOMAIN}")
|
2019-12-31 13:34:53 +00:00
|
|
|
assert state
|
|
|
|
assert state.state == local_ip
|