mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Replace util.get_local_ip in favor of components.network.async_get_source_ip() - part 1 (#52980)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"""Tests for the local_ip component."""
|
||||
from homeassistant.components.local_ip import DOMAIN
|
||||
from homeassistant.util import get_local_ip
|
||||
from homeassistant.components.network import async_get_source_ip
|
||||
from homeassistant.components.zeroconf import MDNS_TARGET_IP
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@@ -13,7 +14,7 @@ async def test_basic_setup(hass):
|
||||
await hass.config_entries.async_setup(entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
local_ip = await hass.async_add_executor_job(get_local_ip)
|
||||
local_ip = await async_get_source_ip(hass, target_ip=MDNS_TARGET_IP)
|
||||
state = hass.states.get(f"sensor.{DOMAIN}")
|
||||
assert state
|
||||
assert state.state == local_ip
|
||||
|
||||
Reference in New Issue
Block a user