mirror of
https://github.com/home-assistant/core.git
synced 2026-08-24 10:13:52 -05:00
Register legacy notify action before setup test in Notifications for Android TV / Fire TV integration (#176535)
This commit is contained in:
@@ -30,6 +30,16 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: NFAndroidTVConfigEntry) -> bool:
|
||||
"""Set up NFAndroidTV from a config entry."""
|
||||
|
||||
hass.async_create_task(
|
||||
discovery.async_load_platform(
|
||||
hass,
|
||||
Platform.NOTIFY,
|
||||
DOMAIN,
|
||||
{CONF_NAME: entry.title, **entry.data},
|
||||
hass.data[DATA_HASS_CONFIG],
|
||||
)
|
||||
)
|
||||
|
||||
try:
|
||||
client = await hass.async_add_executor_job(Notifications, entry.data[CONF_HOST])
|
||||
except ConnectError as e:
|
||||
@@ -42,16 +52,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: NFAndroidTVConfigEntry)
|
||||
|
||||
entry.runtime_data = client
|
||||
|
||||
hass.async_create_task(
|
||||
discovery.async_load_platform(
|
||||
hass,
|
||||
Platform.NOTIFY,
|
||||
DOMAIN,
|
||||
{CONF_NAME: entry.title, **entry.data},
|
||||
hass.data[DATA_HASS_CONFIG],
|
||||
)
|
||||
)
|
||||
|
||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||
|
||||
return True
|
||||
|
||||
@@ -5,6 +5,7 @@ from unittest.mock import AsyncMock
|
||||
from notifications_android_tv.notifications import ConnectError
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.notify import DOMAIN as NOTIFY_DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
@@ -41,3 +42,4 @@ async def test_config_entry_not_ready(
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert config_entry.state is ConfigEntryState.SETUP_RETRY
|
||||
assert hass.services.has_service(NOTIFY_DOMAIN, "android_tv_fire_tv_1_2_3_4")
|
||||
|
||||
Reference in New Issue
Block a user