mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-11-16 22:40:47 +00:00
* Listen for dbus property changes * Avoid remaking dbus proxy objects * proper snake case for pylint * some cleanup and more tests
25 lines
694 B
Python
25 lines
694 B
Python
"""Test host control."""
|
|
|
|
import asyncio
|
|
|
|
from supervisor.coresys import CoreSys
|
|
|
|
from tests.common import fire_property_change_signal
|
|
|
|
|
|
async def test_set_hostname(coresys: CoreSys, dbus: list[str]):
|
|
"""Test set hostname."""
|
|
await coresys.dbus.hostname.connect(coresys.dbus.bus)
|
|
|
|
assert coresys.dbus.hostname.hostname == "homeassistant-n2"
|
|
|
|
dbus.clear()
|
|
await coresys.host.control.set_hostname("test")
|
|
assert dbus == [
|
|
"/org/freedesktop/hostname1-org.freedesktop.hostname1.SetStaticHostname"
|
|
]
|
|
|
|
fire_property_change_signal(coresys.dbus.hostname, {"StaticHostname": "test"})
|
|
await asyncio.sleep(0)
|
|
assert coresys.dbus.hostname.hostname == "test"
|