1
0
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:
Joakim Sørensen
2021-09-22 11:15:38 +02:00
committed by GitHub
parent 6d2a38c96e
commit 40bcee38f3
7 changed files with 270 additions and 45 deletions

View 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