mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 12:47:08 +00:00
Fix broken time trigger test (#42606)
This commit is contained in:
parent
1215100f9a
commit
7027b01a29
@ -61,6 +61,7 @@ async def test_websocket_core_update(hass, client):
|
|||||||
assert hass.config.external_url != "https://www.example.com"
|
assert hass.config.external_url != "https://www.example.com"
|
||||||
assert hass.config.internal_url != "http://example.com"
|
assert hass.config.internal_url != "http://example.com"
|
||||||
|
|
||||||
|
with patch("homeassistant.util.dt.set_default_time_zone") as mock_set_tz:
|
||||||
await client.send_json(
|
await client.send_json(
|
||||||
{
|
{
|
||||||
"id": 5,
|
"id": 5,
|
||||||
@ -86,11 +87,11 @@ async def test_websocket_core_update(hass, client):
|
|||||||
assert hass.config.elevation == 25
|
assert hass.config.elevation == 25
|
||||||
assert hass.config.location_name == "Huis"
|
assert hass.config.location_name == "Huis"
|
||||||
assert hass.config.units.name == CONF_UNIT_SYSTEM_IMPERIAL
|
assert hass.config.units.name == CONF_UNIT_SYSTEM_IMPERIAL
|
||||||
assert hass.config.time_zone.zone == "America/New_York"
|
|
||||||
assert hass.config.external_url == "https://www.example.com"
|
assert hass.config.external_url == "https://www.example.com"
|
||||||
assert hass.config.internal_url == "http://example.local"
|
assert hass.config.internal_url == "http://example.local"
|
||||||
|
|
||||||
dt_util.set_default_time_zone(ORIG_TIME_ZONE)
|
assert len(mock_set_tz.mock_calls) == 1
|
||||||
|
assert mock_set_tz.mock_calls[0][1][0].zone == "America/New_York"
|
||||||
|
|
||||||
|
|
||||||
async def test_websocket_core_update_not_admin(hass, hass_ws_client, hass_admin_user):
|
async def test_websocket_core_update_not_admin(hass, hass_ws_client, hass_admin_user):
|
||||||
|
@ -186,6 +186,7 @@ async def test_setup_core_push_timezone(hass, aioclient_mock):
|
|||||||
assert aioclient_mock.call_count == 7
|
assert aioclient_mock.call_count == 7
|
||||||
assert aioclient_mock.mock_calls[2][2]["timezone"] == "testzone"
|
assert aioclient_mock.mock_calls[2][2]["timezone"] == "testzone"
|
||||||
|
|
||||||
|
with patch("homeassistant.util.dt.set_default_time_zone"):
|
||||||
await hass.config.async_update(time_zone="America/New_York")
|
await hass.config.async_update(time_zone="America/New_York")
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
assert aioclient_mock.mock_calls[-1][2]["timezone"] == "America/New_York"
|
assert aioclient_mock.mock_calls[-1][2]["timezone"] == "America/New_York"
|
||||||
|
@ -74,7 +74,6 @@ async def test_if_fires_using_at_input_datetime(hass, calls, has_date, has_time)
|
|||||||
"input_datetime",
|
"input_datetime",
|
||||||
{"input_datetime": {"trigger": {"has_date": has_date, "has_time": has_time}}},
|
{"input_datetime": {"trigger": {"has_date": has_date, "has_time": has_time}}},
|
||||||
)
|
)
|
||||||
|
|
||||||
now = dt_util.now()
|
now = dt_util.now()
|
||||||
|
|
||||||
trigger_dt = now.replace(
|
trigger_dt = now.replace(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user