Ensure config entry platforms are excluded from reload (#42367)

This commit is contained in:
J. Nick Koston
2020-10-25 23:53:31 +01:00
committed by GitHub
parent fe62543a25
commit ce2c388c09
3 changed files with 19 additions and 5 deletions
+8 -2
View File
@@ -7,8 +7,9 @@ import pytest
from homeassistant import config
from homeassistant.const import SERVICE_RELOAD
from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.helpers.entity_platform import async_get_platforms
from homeassistant.helpers.reload import (
async_get_platform,
async_get_platform_without_config_entry,
async_integration_yaml_config,
async_reload_integration_platforms,
async_setup_reload_service,
@@ -52,7 +53,7 @@ async def test_reload_platform(hass):
assert f"{DOMAIN}.{PLATFORM}" in hass.config.components
assert len(setup_called) == 1
platform = async_get_platform(hass, PLATFORM, DOMAIN)
platform = async_get_platform_without_config_entry(hass, PLATFORM, DOMAIN)
assert platform.platform_name == PLATFORM
assert platform.domain == DOMAIN
@@ -66,6 +67,11 @@ async def test_reload_platform(hass):
assert len(setup_called) == 2
existing_platforms = async_get_platforms(hass, PLATFORM)
for existing_platform in existing_platforms:
existing_platform.config_entry = "abc"
assert not async_get_platform_without_config_entry(hass, PLATFORM, DOMAIN)
async def test_setup_reload_service(hass):
"""Test setting up a reload service."""