mirror of
https://github.com/home-assistant/core.git
synced 2026-04-25 21:17:23 +00:00
Mock HMConnection in homematic notify tests (#164381)
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
"""The tests for the Homematic notification platform."""
|
||||
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from homeassistant.components.notify import DOMAIN as NOTIFY_DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
@@ -9,11 +11,15 @@ from tests.common import assert_setup_component
|
||||
|
||||
async def test_setup_full(hass: HomeAssistant) -> None:
|
||||
"""Test valid configuration."""
|
||||
await async_setup_component(
|
||||
hass,
|
||||
"homematic",
|
||||
{"homematic": {"hosts": {"ccu2": {"host": "127.0.0.1"}}}},
|
||||
)
|
||||
with patch(
|
||||
"homeassistant.components.homematic.HMConnection",
|
||||
return_value=MagicMock(),
|
||||
):
|
||||
await async_setup_component(
|
||||
hass,
|
||||
"homematic",
|
||||
{"homematic": {"hosts": {"ccu2": {"host": "127.0.0.1"}}}},
|
||||
)
|
||||
with assert_setup_component(1, domain="notify") as handle_config:
|
||||
assert await async_setup_component(
|
||||
hass,
|
||||
@@ -35,11 +41,15 @@ async def test_setup_full(hass: HomeAssistant) -> None:
|
||||
|
||||
async def test_setup_without_optional(hass: HomeAssistant) -> None:
|
||||
"""Test valid configuration without optional."""
|
||||
await async_setup_component(
|
||||
hass,
|
||||
"homematic",
|
||||
{"homematic": {"hosts": {"ccu2": {"host": "127.0.0.1"}}}},
|
||||
)
|
||||
with patch(
|
||||
"homeassistant.components.homematic.HMConnection",
|
||||
return_value=MagicMock(),
|
||||
):
|
||||
await async_setup_component(
|
||||
hass,
|
||||
"homematic",
|
||||
{"homematic": {"hosts": {"ccu2": {"host": "127.0.0.1"}}}},
|
||||
)
|
||||
with assert_setup_component(1, domain="notify") as handle_config:
|
||||
assert await async_setup_component(
|
||||
hass,
|
||||
|
||||
Reference in New Issue
Block a user