2018-10-12 07:36:52 +00:00
|
|
|
"""The tests for the Homematic notification platform."""
|
2024-03-08 18:16:21 +00:00
|
|
|
|
2024-06-22 07:06:31 +00:00
|
|
|
from homeassistant.components.notify import DOMAIN as NOTIFY_DOMAIN
|
2023-02-08 17:12:56 +00:00
|
|
|
from homeassistant.core import HomeAssistant
|
2020-10-13 17:51:08 +00:00
|
|
|
from homeassistant.setup import async_setup_component
|
2018-10-12 07:36:52 +00:00
|
|
|
|
2020-10-13 17:51:08 +00:00
|
|
|
from tests.common import assert_setup_component
|
2018-10-12 07:36:52 +00:00
|
|
|
|
|
|
|
|
2023-02-08 17:12:56 +00:00
|
|
|
async def test_setup_full(hass: HomeAssistant) -> None:
|
2020-10-13 17:51:08 +00:00
|
|
|
"""Test valid configuration."""
|
|
|
|
await async_setup_component(
|
|
|
|
hass,
|
|
|
|
"homematic",
|
|
|
|
{"homematic": {"hosts": {"ccu2": {"host": "127.0.0.1"}}}},
|
|
|
|
)
|
2024-05-11 19:13:44 +00:00
|
|
|
with assert_setup_component(1, domain="notify") as handle_config:
|
2020-10-13 17:51:08 +00:00
|
|
|
assert await async_setup_component(
|
|
|
|
hass,
|
|
|
|
"notify",
|
|
|
|
{
|
|
|
|
"notify": {
|
|
|
|
"name": "test",
|
|
|
|
"platform": "homematic",
|
|
|
|
"address": "NEQXXXXXXX",
|
|
|
|
"channel": 2,
|
|
|
|
"param": "SUBMIT",
|
|
|
|
"value": "1,1,108000,2",
|
|
|
|
"interface": "my-interface",
|
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
2024-06-22 07:06:31 +00:00
|
|
|
assert handle_config[NOTIFY_DOMAIN]
|
2018-10-12 07:36:52 +00:00
|
|
|
|
|
|
|
|
2023-02-08 17:12:56 +00:00
|
|
|
async def test_setup_without_optional(hass: HomeAssistant) -> None:
|
2020-10-13 17:51:08 +00:00
|
|
|
"""Test valid configuration without optional."""
|
|
|
|
await async_setup_component(
|
|
|
|
hass,
|
|
|
|
"homematic",
|
|
|
|
{"homematic": {"hosts": {"ccu2": {"host": "127.0.0.1"}}}},
|
|
|
|
)
|
2024-05-11 19:13:44 +00:00
|
|
|
with assert_setup_component(1, domain="notify") as handle_config:
|
2020-10-13 17:51:08 +00:00
|
|
|
assert await async_setup_component(
|
|
|
|
hass,
|
|
|
|
"notify",
|
|
|
|
{
|
|
|
|
"notify": {
|
|
|
|
"name": "test",
|
|
|
|
"platform": "homematic",
|
|
|
|
"address": "NEQXXXXXXX",
|
|
|
|
"channel": 2,
|
|
|
|
"param": "SUBMIT",
|
|
|
|
"value": "1,1,108000,2",
|
|
|
|
}
|
|
|
|
},
|
2019-07-31 19:25:30 +00:00
|
|
|
)
|
2024-06-22 07:06:31 +00:00
|
|
|
assert handle_config[NOTIFY_DOMAIN]
|
2018-10-12 07:36:52 +00:00
|
|
|
|
|
|
|
|
2023-02-08 17:12:56 +00:00
|
|
|
async def test_bad_config(hass: HomeAssistant) -> None:
|
2020-10-13 17:51:08 +00:00
|
|
|
"""Test invalid configuration."""
|
2024-06-22 07:06:31 +00:00
|
|
|
config = {NOTIFY_DOMAIN: {"name": "test", "platform": "homematic"}}
|
2024-05-11 19:13:44 +00:00
|
|
|
with assert_setup_component(0, domain="notify") as handle_config:
|
2024-06-22 07:06:31 +00:00
|
|
|
assert await async_setup_component(hass, NOTIFY_DOMAIN, config)
|
|
|
|
assert not handle_config[NOTIFY_DOMAIN]
|