mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-12-24 12:29:08 +00:00
Add startup time and boot_timestamp (#3136)
* Add startup time * Add boot_timestamp * Fix type * patch and rename properties fixture
This commit is contained in:
27
tests/dbus/test_systemd.py
Normal file
27
tests/dbus/test_systemd.py
Normal file
@@ -0,0 +1,27 @@
|
||||
"""Test hostname dbus interface."""
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
from supervisor.coresys import CoreSys
|
||||
from supervisor.dbus.const import DBUS_NAME_SYSTEMD
|
||||
|
||||
from tests.common import load_json_fixture
|
||||
|
||||
|
||||
async def test_dbus_systemd_info(coresys: CoreSys):
|
||||
"""Test coresys dbus connection."""
|
||||
assert coresys.dbus.systemd.boot_timestamp is None
|
||||
assert coresys.dbus.systemd.startup_time is None
|
||||
|
||||
await coresys.dbus.systemd.connect()
|
||||
|
||||
async def mock_get_properties(dbus_obj, interface):
|
||||
return load_json_fixture(
|
||||
f"{DBUS_NAME_SYSTEMD.replace('.', '_')}_properties.json"
|
||||
)
|
||||
|
||||
with patch("supervisor.utils.gdbus.DBus.get_properties", new=mock_get_properties):
|
||||
await coresys.dbus.systemd.update()
|
||||
|
||||
assert coresys.dbus.systemd.boot_timestamp == 1632236713344227
|
||||
assert coresys.dbus.systemd.startup_time == 45.304696
|
||||
Reference in New Issue
Block a user