mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-11-13 04:50:21 +00:00
Propagate timezone setting to host in OS 16.2 and newer (#6099)
* Propagate timezone setting to host in OS 16.2 and newer With home-assistant/operating-system#4224, timezone setting in OS can be peristently set in HAOS as well. Propagate the timezone configured in Supervisor config (which can be changed through general system settings in HA Core) through the DBus API for setting the timezone. * Persist timezone also when it's been obtained from Whoami * Suppress pylint fixme error
This commit is contained in:
@@ -82,6 +82,24 @@ async def test_dbus_setntp(
|
||||
assert timedate.ntp is False
|
||||
|
||||
|
||||
async def test_dbus_set_timezone(
|
||||
timedate_service: TimeDateService, dbus_session_bus: MessageBus
|
||||
):
|
||||
"""Test setting of host timezone."""
|
||||
timedate_service.SetTimezone.calls.clear()
|
||||
timedate = TimeDate()
|
||||
|
||||
with pytest.raises(DBusNotConnectedError):
|
||||
await timedate.set_timezone("Europe/Prague")
|
||||
|
||||
await timedate.connect(dbus_session_bus)
|
||||
|
||||
assert await timedate.set_timezone("Europe/Prague") is None
|
||||
assert timedate_service.SetTimezone.calls == [("Europe/Prague", False)]
|
||||
await timedate_service.ping()
|
||||
assert timedate.timezone == "Europe/Prague"
|
||||
|
||||
|
||||
async def test_dbus_timedate_connect_error(
|
||||
dbus_session_bus: MessageBus, caplog: pytest.LogCaptureFixture
|
||||
):
|
||||
|
||||
Reference in New Issue
Block a user