mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Remove deprecated hass.components
from netatmo webhook tests (#113691)
This commit is contained in:
parent
cb348ddbdb
commit
f73f93913f
@ -10,6 +10,7 @@ import pytest
|
|||||||
from syrupy import SnapshotAssertion
|
from syrupy import SnapshotAssertion
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
|
from homeassistant.components import cloud
|
||||||
from homeassistant.components.netatmo import DOMAIN
|
from homeassistant.components.netatmo import DOMAIN
|
||||||
from homeassistant.const import CONF_WEBHOOK_ID, Platform
|
from homeassistant.const import CONF_WEBHOOK_ID, Platform
|
||||||
from homeassistant.core import CoreState, HomeAssistant
|
from homeassistant.core import CoreState, HomeAssistant
|
||||||
@ -200,10 +201,8 @@ async def test_setup_with_cloud(
|
|||||||
|
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.cloud.async_is_logged_in", return_value=True
|
"homeassistant.components.cloud.async_is_logged_in", return_value=True
|
||||||
), patch(
|
), patch.object(cloud, "async_is_connected", return_value=True), patch.object(
|
||||||
"homeassistant.components.cloud.async_is_connected", return_value=True
|
cloud, "async_active_subscription", return_value=True
|
||||||
), patch(
|
|
||||||
"homeassistant.components.cloud.async_active_subscription", return_value=True
|
|
||||||
), patch(
|
), patch(
|
||||||
"homeassistant.components.cloud.async_create_cloudhook",
|
"homeassistant.components.cloud.async_create_cloudhook",
|
||||||
return_value="https://hooks.nabu.casa/ABCD",
|
return_value="https://hooks.nabu.casa/ABCD",
|
||||||
@ -222,8 +221,8 @@ async def test_setup_with_cloud(
|
|||||||
assert await async_setup_component(
|
assert await async_setup_component(
|
||||||
hass, "netatmo", {"netatmo": {"client_id": "123", "client_secret": "abc"}}
|
hass, "netatmo", {"netatmo": {"client_id": "123", "client_secret": "abc"}}
|
||||||
)
|
)
|
||||||
assert hass.components.cloud.async_active_subscription() is True
|
assert cloud.async_active_subscription(hass) is True
|
||||||
assert hass.components.cloud.async_is_connected() is True
|
assert cloud.async_is_connected(hass) is True
|
||||||
fake_create_cloudhook.assert_called_once()
|
fake_create_cloudhook.assert_called_once()
|
||||||
|
|
||||||
assert (
|
assert (
|
||||||
@ -268,9 +267,7 @@ async def test_setup_with_cloudhook(hass: HomeAssistant) -> None:
|
|||||||
"homeassistant.components.cloud.async_is_logged_in", return_value=True
|
"homeassistant.components.cloud.async_is_logged_in", return_value=True
|
||||||
), patch(
|
), patch(
|
||||||
"homeassistant.components.cloud.async_is_connected", return_value=True
|
"homeassistant.components.cloud.async_is_connected", return_value=True
|
||||||
), patch(
|
), patch.object(cloud, "async_active_subscription", return_value=True), patch(
|
||||||
"homeassistant.components.cloud.async_active_subscription", return_value=True
|
|
||||||
), patch(
|
|
||||||
"homeassistant.components.cloud.async_create_cloudhook",
|
"homeassistant.components.cloud.async_create_cloudhook",
|
||||||
return_value="https://hooks.nabu.casa/ABCD",
|
return_value="https://hooks.nabu.casa/ABCD",
|
||||||
) as fake_create_cloudhook, patch(
|
) as fake_create_cloudhook, patch(
|
||||||
@ -288,7 +285,7 @@ async def test_setup_with_cloudhook(hass: HomeAssistant) -> None:
|
|||||||
mock_auth.return_value.async_addwebhook.side_effect = AsyncMock()
|
mock_auth.return_value.async_addwebhook.side_effect = AsyncMock()
|
||||||
mock_auth.return_value.async_dropwebhook.side_effect = AsyncMock()
|
mock_auth.return_value.async_dropwebhook.side_effect = AsyncMock()
|
||||||
assert await async_setup_component(hass, "netatmo", {})
|
assert await async_setup_component(hass, "netatmo", {})
|
||||||
assert hass.components.cloud.async_active_subscription() is True
|
assert cloud.async_active_subscription(hass) is True
|
||||||
|
|
||||||
assert (
|
assert (
|
||||||
hass.config_entries.async_entries("netatmo")[0].data["cloudhook_url"]
|
hass.config_entries.async_entries("netatmo")[0].data["cloudhook_url"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user