mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-04-27 22:57:15 +00:00

* Add new time handling * migrate date for python3.9 * add timedate * add tests & simplify it * better testing * use ssl * use hostname with new interface * expose to API * update data * add base handler * new timezone handling * improve handling * Improve handling * Add tests * Time adjustment function * Fix logging * tweak condition * don't adjust synchronized time * Guard * ignore UTC * small cleanup * like that, we can leaf it * add URL * add comment * Apply suggestions from code review Co-authored-by: Joakim Sørensen <joasoe@gmail.com> Co-authored-by: Joakim Sørensen <joasoe@gmail.com>
34 lines
1.0 KiB
Python
34 lines
1.0 KiB
Python
"""Test hostname dbus interface."""
|
|
|
|
import pytest
|
|
|
|
from supervisor.coresys import CoreSys
|
|
from supervisor.exceptions import DBusNotConnectedError
|
|
|
|
|
|
async def test_dbus_hostname_info(coresys: CoreSys):
|
|
"""Test coresys dbus connection."""
|
|
assert coresys.dbus.hostname.hostname is None
|
|
|
|
await coresys.dbus.hostname.connect()
|
|
await coresys.dbus.hostname.update()
|
|
|
|
assert coresys.dbus.hostname.hostname == "homeassistant-n2"
|
|
assert coresys.dbus.hostname.kernel == "5.10.33"
|
|
assert (
|
|
coresys.dbus.hostname.cpe
|
|
== "cpe:2.3:o:home-assistant:haos:6.0.dev20210504:*:development:*:*:*:odroid-n2:*"
|
|
)
|
|
assert coresys.dbus.hostname.operating_system == "Home Assistant OS 6.0.dev20210504"
|
|
|
|
|
|
async def test_dbus_sethostname(coresys: CoreSys):
|
|
"""Set hostname on backend."""
|
|
|
|
with pytest.raises(DBusNotConnectedError):
|
|
await coresys.dbus.hostname.set_static_hostname("StarWars")
|
|
|
|
await coresys.dbus.hostname.connect()
|
|
|
|
await coresys.dbus.hostname.set_static_hostname("StarWars")
|