Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 18 additions & 17 deletions tests/components/config/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,23 @@ async def test_websocket_core_update(hass, client):
assert hass.config.external_url != "https://www.example.com"
assert hass.config.internal_url != "http://example.com"

await client.send_json(
{
"id": 5,
"type": "config/core/update",
"latitude": 60,
"longitude": 50,
"elevation": 25,
"location_name": "Huis",
CONF_UNIT_SYSTEM: CONF_UNIT_SYSTEM_IMPERIAL,
"time_zone": "America/New_York",
"external_url": "https://www.example.com",
"internal_url": "http://example.local",
}
)
with patch("homeassistant.util.dt.set_default_time_zone") as mock_set_tz:
await client.send_json(
{
"id": 5,
"type": "config/core/update",
"latitude": 60,
"longitude": 50,
"elevation": 25,
"location_name": "Huis",
CONF_UNIT_SYSTEM: CONF_UNIT_SYSTEM_IMPERIAL,
"time_zone": "America/New_York",
"external_url": "https://www.example.com",
"internal_url": "http://example.local",
}
)

msg = await client.receive_json()
msg = await client.receive_json()

assert msg["id"] == 5
assert msg["type"] == TYPE_RESULT
Expand All @@ -86,11 +87,11 @@ async def test_websocket_core_update(hass, client):
assert hass.config.elevation == 25
assert hass.config.location_name == "Huis"
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.internal_url == "http://example.local"

dt_util.set_default_time_zone(ORIG_TIME_ZONE)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing this makes the global definition of ORIG_TIME_ZONE redundant.

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):
Expand Down
3 changes: 2 additions & 1 deletion tests/components/hassio/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ async def test_setup_core_push_timezone(hass, aioclient_mock):
assert aioclient_mock.call_count == 7
assert aioclient_mock.mock_calls[2][2]["timezone"] == "testzone"

await hass.config.async_update(time_zone="America/New_York")
with patch("homeassistant.util.dt.set_default_time_zone"):
await hass.config.async_update(time_zone="America/New_York")
await hass.async_block_till_done()
assert aioclient_mock.mock_calls[-1][2]["timezone"] == "America/New_York"

Expand Down
1 change: 0 additions & 1 deletion tests/components/homeassistant/triggers/test_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ async def test_if_fires_using_at_input_datetime(hass, calls, has_date, has_time)
"input_datetime",
{"input_datetime": {"trigger": {"has_date": has_date, "has_time": has_time}}},
)

now = dt_util.now()

trigger_dt = now.replace(
Expand Down