mirror of
https://github.com/home-assistant/core.git
synced 2026-04-24 10:49:45 +01:00
Bump ruff to 0.3.4 (#112690)
Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com> Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
committed by
GitHub
parent
27219b6962
commit
6bb4e7d62c
@@ -749,14 +749,17 @@ async def test_websocket_status(
|
||||
cloud.iot.state = STATE_CONNECTED
|
||||
client = await hass_ws_client(hass)
|
||||
|
||||
with patch.dict(
|
||||
"homeassistant.components.google_assistant.const.DOMAIN_TO_GOOGLE_TYPES",
|
||||
{"light": None},
|
||||
clear=True,
|
||||
), patch.dict(
|
||||
"homeassistant.components.alexa.entities.ENTITY_ADAPTERS",
|
||||
{"switch": None},
|
||||
clear=True,
|
||||
with (
|
||||
patch.dict(
|
||||
"homeassistant.components.google_assistant.const.DOMAIN_TO_GOOGLE_TYPES",
|
||||
{"light": None},
|
||||
clear=True,
|
||||
),
|
||||
patch.dict(
|
||||
"homeassistant.components.alexa.entities.ENTITY_ADAPTERS",
|
||||
{"switch": None},
|
||||
clear=True,
|
||||
),
|
||||
):
|
||||
await client.send_json({"id": 5, "type": "cloud/status"})
|
||||
response = await client.receive_json()
|
||||
@@ -954,16 +957,20 @@ async def test_websocket_update_preferences_alexa_report_state(
|
||||
"""Test updating alexa_report_state sets alexa authorized."""
|
||||
client = await hass_ws_client(hass)
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.cloud.alexa_config.CloudAlexaConfig.async_sync_entities"
|
||||
), patch(
|
||||
(
|
||||
"homeassistant.components.cloud.alexa_config.CloudAlexaConfig"
|
||||
".async_get_access_token"
|
||||
with (
|
||||
patch(
|
||||
"homeassistant.components.cloud.alexa_config.CloudAlexaConfig.async_sync_entities"
|
||||
),
|
||||
), patch(
|
||||
"homeassistant.components.cloud.alexa_config.CloudAlexaConfig.set_authorized"
|
||||
) as set_authorized_mock:
|
||||
patch(
|
||||
(
|
||||
"homeassistant.components.cloud.alexa_config.CloudAlexaConfig"
|
||||
".async_get_access_token"
|
||||
),
|
||||
),
|
||||
patch(
|
||||
"homeassistant.components.cloud.alexa_config.CloudAlexaConfig.set_authorized"
|
||||
) as set_authorized_mock,
|
||||
):
|
||||
set_authorized_mock.assert_not_called()
|
||||
|
||||
await client.send_json(
|
||||
@@ -985,15 +992,18 @@ async def test_websocket_update_preferences_require_relink(
|
||||
"""Test updating preference requires relink."""
|
||||
client = await hass_ws_client(hass)
|
||||
|
||||
with patch(
|
||||
(
|
||||
"homeassistant.components.cloud.alexa_config.CloudAlexaConfig"
|
||||
".async_get_access_token"
|
||||
with (
|
||||
patch(
|
||||
(
|
||||
"homeassistant.components.cloud.alexa_config.CloudAlexaConfig"
|
||||
".async_get_access_token"
|
||||
),
|
||||
side_effect=alexa_errors.RequireRelink,
|
||||
),
|
||||
side_effect=alexa_errors.RequireRelink,
|
||||
), patch(
|
||||
"homeassistant.components.cloud.alexa_config.CloudAlexaConfig.set_authorized"
|
||||
) as set_authorized_mock:
|
||||
patch(
|
||||
"homeassistant.components.cloud.alexa_config.CloudAlexaConfig.set_authorized"
|
||||
) as set_authorized_mock,
|
||||
):
|
||||
set_authorized_mock.assert_not_called()
|
||||
|
||||
await client.send_json(
|
||||
@@ -1015,15 +1025,18 @@ async def test_websocket_update_preferences_no_token(
|
||||
"""Test updating preference no token available."""
|
||||
client = await hass_ws_client(hass)
|
||||
|
||||
with patch(
|
||||
(
|
||||
"homeassistant.components.cloud.alexa_config.CloudAlexaConfig"
|
||||
".async_get_access_token"
|
||||
with (
|
||||
patch(
|
||||
(
|
||||
"homeassistant.components.cloud.alexa_config.CloudAlexaConfig"
|
||||
".async_get_access_token"
|
||||
),
|
||||
side_effect=alexa_errors.NoTokenAvailable,
|
||||
),
|
||||
side_effect=alexa_errors.NoTokenAvailable,
|
||||
), patch(
|
||||
"homeassistant.components.cloud.alexa_config.CloudAlexaConfig.set_authorized"
|
||||
) as set_authorized_mock:
|
||||
patch(
|
||||
"homeassistant.components.cloud.alexa_config.CloudAlexaConfig.set_authorized"
|
||||
) as set_authorized_mock,
|
||||
):
|
||||
set_authorized_mock.assert_not_called()
|
||||
|
||||
await client.send_json(
|
||||
@@ -1357,13 +1370,16 @@ async def test_list_alexa_entities(
|
||||
"interfaces": ["Alexa.PowerController", "Alexa.EndpointHealth", "Alexa"],
|
||||
}
|
||||
|
||||
with patch(
|
||||
(
|
||||
"homeassistant.components.cloud.alexa_config.CloudAlexaConfig"
|
||||
".async_get_access_token"
|
||||
with (
|
||||
patch(
|
||||
(
|
||||
"homeassistant.components.cloud.alexa_config.CloudAlexaConfig"
|
||||
".async_get_access_token"
|
||||
),
|
||||
),
|
||||
patch(
|
||||
"homeassistant.components.cloud.alexa_config.alexa_state_report.async_send_add_or_update_message"
|
||||
),
|
||||
), patch(
|
||||
"homeassistant.components.cloud.alexa_config.alexa_state_report.async_send_add_or_update_message"
|
||||
):
|
||||
# Add the entity to the entity registry
|
||||
entity_registry.async_get_or_create(
|
||||
|
||||
Reference in New Issue
Block a user