mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-24 09:36:31 +00:00
Update resolved information with host info (#3560)
This commit is contained in:
parent
61d79b6b9c
commit
a553ba5d24
@ -155,5 +155,7 @@ class InfoCenter(CoreSysAttributes):
|
||||
await self.sys_dbus.timedate.update()
|
||||
if self.sys_dbus.systemd.is_connected:
|
||||
await self.sys_dbus.systemd.update()
|
||||
if self.sys_dbus.resolved.is_connected:
|
||||
await self.sys_dbus.resolved.update()
|
||||
except DBusError:
|
||||
_LOGGER.warning("Can't update host system information!")
|
||||
|
@ -23,6 +23,7 @@ from supervisor.dbus.const import DBUS_SIGNAL_NM_CONNECTION_ACTIVE_CHANGED
|
||||
from supervisor.dbus.hostname import Hostname
|
||||
from supervisor.dbus.interface import DBusInterface
|
||||
from supervisor.dbus.network import NetworkManager
|
||||
from supervisor.dbus.resolved import Resolved
|
||||
from supervisor.dbus.systemd import Systemd
|
||||
from supervisor.dbus.timedate import TimeDate
|
||||
from supervisor.docker import DockerAPI
|
||||
@ -178,11 +179,17 @@ async def systemd(dbus: DBus) -> Systemd:
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
async def os_agent(dbus: DBus) -> Systemd:
|
||||
async def os_agent(dbus: DBus) -> OSAgent:
|
||||
"""Mock OSAgent."""
|
||||
yield await mock_dbus_interface(dbus, OSAgent())
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
async def resolved(dbus: DBus) -> Resolved:
|
||||
"""Mock REsolved."""
|
||||
yield await mock_dbus_interface(dbus, Resolved())
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
async def coresys(loop, docker, network_manager, aiohttp_client, run_dir) -> CoreSys:
|
||||
"""Create a CoreSys Mock."""
|
||||
|
@ -3,7 +3,9 @@ from unittest.mock import AsyncMock, PropertyMock, patch
|
||||
|
||||
from supervisor.coresys import CoreSys
|
||||
from supervisor.dbus.agent import OSAgent
|
||||
from supervisor.dbus.const import MulticastProtocolEnabled
|
||||
from supervisor.dbus.hostname import Hostname
|
||||
from supervisor.dbus.resolved import Resolved
|
||||
from supervisor.dbus.systemd import Systemd
|
||||
from supervisor.dbus.timedate import TimeDate
|
||||
|
||||
@ -50,12 +52,14 @@ async def test_load(
|
||||
systemd: Systemd,
|
||||
timedate: TimeDate,
|
||||
os_agent: OSAgent,
|
||||
resolved: Resolved,
|
||||
):
|
||||
"""Test manager load."""
|
||||
type(coresys.dbus).hostname = PropertyMock(return_value=hostname)
|
||||
type(coresys.dbus).systemd = PropertyMock(return_value=systemd)
|
||||
type(coresys.dbus).timedate = PropertyMock(return_value=timedate)
|
||||
type(coresys.dbus).agent = PropertyMock(return_value=os_agent)
|
||||
type(coresys.dbus).resolved = PropertyMock(return_value=resolved)
|
||||
|
||||
with patch.object(coresys.host.sound, "update") as sound_update, patch.object(
|
||||
coresys.host.apparmor, "load"
|
||||
@ -65,6 +69,7 @@ async def test_load(
|
||||
assert coresys.dbus.systemd.boot_timestamp is None
|
||||
assert coresys.dbus.timedate.timezone is None
|
||||
assert coresys.dbus.agent.diagnostics is None
|
||||
assert coresys.dbus.resolved.multicast_dns is None
|
||||
|
||||
await coresys.host.load()
|
||||
|
||||
@ -73,6 +78,7 @@ async def test_load(
|
||||
assert coresys.dbus.timedate.timezone == "Etc/UTC"
|
||||
assert coresys.dbus.agent.diagnostics is True
|
||||
assert coresys.dbus.network.connectivity_enabled is True
|
||||
assert coresys.dbus.resolved.multicast_dns == MulticastProtocolEnabled.RESOLVE
|
||||
|
||||
sound_update.assert_called_once()
|
||||
apparmor_load.assert_called_once()
|
||||
|
Loading…
x
Reference in New Issue
Block a user