1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Make integration setup optional (#48381)

This commit is contained in:
Franck Nijhof
2021-03-29 22:53:47 +02:00
committed by GitHub
parent dda9f957b6
commit 52475c108f
16 changed files with 39 additions and 77 deletions

View File

@@ -2,7 +2,6 @@
from __future__ import annotations
import asyncio
from typing import Any
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
@@ -14,11 +13,6 @@ from .const import DOMAIN
PLATFORMS = ["light"]
async def async_setup(hass: HomeAssistant, config: dict[str, Any]) -> bool:
"""Set up the NEW_NAME component."""
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up NEW_NAME from a config entry."""
# TODO Store an API object for your platforms to access

View File

@@ -20,8 +20,6 @@ async def test_form(hass: HomeAssistant) -> None:
"homeassistant.components.NEW_DOMAIN.config_flow.PlaceholderHub.authenticate",
return_value=True,
), patch(
"homeassistant.components.NEW_DOMAIN.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.NEW_DOMAIN.async_setup_entry",
return_value=True,
) as mock_setup_entry:
@@ -42,7 +40,6 @@ async def test_form(hass: HomeAssistant) -> None:
"username": "test-username",
"password": "test-password",
}
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1

View File

@@ -2,7 +2,6 @@
from __future__ import annotations
import asyncio
from typing import Any
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
@@ -14,11 +13,6 @@ from .const import DOMAIN
PLATFORMS = ["light"]
async def async_setup(hass: HomeAssistant, config: dict[str, Any]) -> bool:
"""Set up the NEW_NAME component."""
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up NEW_NAME from a config entry."""
# TODO Store an API object for your platforms to access