mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 07:07:28 +00:00
Fix patch of PLATFORMS constant in netatmo (#101038)
This commit is contained in:
parent
b8a7ad916a
commit
50827405d0
@ -92,7 +92,11 @@ async def simulate_webhook(hass, webhook_id, response):
|
|||||||
@contextmanager
|
@contextmanager
|
||||||
def selected_platforms(platforms):
|
def selected_platforms(platforms):
|
||||||
"""Restrict loaded platforms to list given."""
|
"""Restrict loaded platforms to list given."""
|
||||||
with patch("homeassistant.components.netatmo.PLATFORMS", platforms), patch(
|
with patch(
|
||||||
|
"homeassistant.components.netatmo.data_handler.PLATFORMS", platforms
|
||||||
|
), patch(
|
||||||
"homeassistant.helpers.config_entry_oauth2_flow.async_get_config_entry_implementation",
|
"homeassistant.helpers.config_entry_oauth2_flow.async_get_config_entry_implementation",
|
||||||
), patch("homeassistant.components.netatmo.webhook_generate_url"):
|
), patch(
|
||||||
|
"homeassistant.components.netatmo.webhook_generate_url"
|
||||||
|
):
|
||||||
yield
|
yield
|
||||||
|
@ -478,7 +478,7 @@ async def test_setup_component_no_devices(hass: HomeAssistant, config_entry) ->
|
|||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.netatmo.api.AsyncConfigEntryNetatmoAuth"
|
"homeassistant.components.netatmo.api.AsyncConfigEntryNetatmoAuth"
|
||||||
) as mock_auth, patch(
|
) as mock_auth, patch(
|
||||||
"homeassistant.components.netatmo.PLATFORMS", ["camera"]
|
"homeassistant.components.netatmo.data_handler.PLATFORMS", ["camera"]
|
||||||
), patch(
|
), patch(
|
||||||
"homeassistant.helpers.config_entry_oauth2_flow.async_get_config_entry_implementation",
|
"homeassistant.helpers.config_entry_oauth2_flow.async_get_config_entry_implementation",
|
||||||
), patch(
|
), patch(
|
||||||
@ -491,7 +491,7 @@ async def test_setup_component_no_devices(hass: HomeAssistant, config_entry) ->
|
|||||||
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
assert fake_post_hits == 11
|
assert fake_post_hits == 8
|
||||||
|
|
||||||
|
|
||||||
async def test_camera_image_raises_exception(
|
async def test_camera_image_raises_exception(
|
||||||
|
@ -201,7 +201,7 @@ async def test_setup_with_cloud(hass: HomeAssistant, config_entry) -> None:
|
|||||||
) as fake_delete_cloudhook, patch(
|
) as fake_delete_cloudhook, patch(
|
||||||
"homeassistant.components.netatmo.api.AsyncConfigEntryNetatmoAuth"
|
"homeassistant.components.netatmo.api.AsyncConfigEntryNetatmoAuth"
|
||||||
) as mock_auth, patch(
|
) as mock_auth, patch(
|
||||||
"homeassistant.components.netatmo.PLATFORMS", []
|
"homeassistant.components.netatmo.data_handler.PLATFORMS", []
|
||||||
), patch(
|
), patch(
|
||||||
"homeassistant.helpers.config_entry_oauth2_flow.async_get_config_entry_implementation",
|
"homeassistant.helpers.config_entry_oauth2_flow.async_get_config_entry_implementation",
|
||||||
), patch(
|
), patch(
|
||||||
@ -267,7 +267,7 @@ async def test_setup_with_cloudhook(hass: HomeAssistant) -> None:
|
|||||||
) as fake_delete_cloudhook, patch(
|
) as fake_delete_cloudhook, patch(
|
||||||
"homeassistant.components.netatmo.api.AsyncConfigEntryNetatmoAuth"
|
"homeassistant.components.netatmo.api.AsyncConfigEntryNetatmoAuth"
|
||||||
) as mock_auth, patch(
|
) as mock_auth, patch(
|
||||||
"homeassistant.components.netatmo.PLATFORMS", []
|
"homeassistant.components.netatmo.data_handler.PLATFORMS", []
|
||||||
), patch(
|
), patch(
|
||||||
"homeassistant.helpers.config_entry_oauth2_flow.async_get_config_entry_implementation",
|
"homeassistant.helpers.config_entry_oauth2_flow.async_get_config_entry_implementation",
|
||||||
), patch(
|
), patch(
|
||||||
|
@ -99,7 +99,7 @@ async def test_setup_component_no_devices(hass: HomeAssistant, config_entry) ->
|
|||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.netatmo.api.AsyncConfigEntryNetatmoAuth"
|
"homeassistant.components.netatmo.api.AsyncConfigEntryNetatmoAuth"
|
||||||
) as mock_auth, patch(
|
) as mock_auth, patch(
|
||||||
"homeassistant.components.netatmo.PLATFORMS", ["light"]
|
"homeassistant.components.netatmo.data_handler.PLATFORMS", ["light"]
|
||||||
), patch(
|
), patch(
|
||||||
"homeassistant.helpers.config_entry_oauth2_flow.async_get_config_entry_implementation",
|
"homeassistant.helpers.config_entry_oauth2_flow.async_get_config_entry_implementation",
|
||||||
), patch(
|
), patch(
|
||||||
@ -120,7 +120,7 @@ async def test_setup_component_no_devices(hass: HomeAssistant, config_entry) ->
|
|||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
assert fake_post_hits == 4
|
assert fake_post_hits == 3
|
||||||
|
|
||||||
assert hass.config_entries.async_entries(DOMAIN)
|
assert hass.config_entries.async_entries(DOMAIN)
|
||||||
assert len(hass.states.async_all()) == 0
|
assert len(hass.states.async_all()) == 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user