Do not attempt to unload non loaded config entries (#51356)

This commit is contained in:
Erik Montnemery 2021-06-02 10:00:24 +02:00 committed by GitHub
parent d51fc5814a
commit 1d9d9021de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 19 additions and 0 deletions

View file

@ -19,6 +19,7 @@ from homeassistant.components.cover import (
STATE_OPENING,
)
from homeassistant.components.smartthings.const import DOMAIN, SIGNAL_SMARTTHINGS_UPDATE
from homeassistant.config_entries import ConfigEntryState
from homeassistant.const import ATTR_BATTERY_LEVEL, ATTR_ENTITY_ID, STATE_UNAVAILABLE
from homeassistant.helpers import device_registry as dr, entity_registry as er
from homeassistant.helpers.dispatcher import async_dispatcher_send
@ -191,6 +192,7 @@ async def test_unload_config_entry(hass, device_factory):
"Garage", [Capability.garage_door_control], {Attribute.door: "open"}
)
config_entry = await setup_platform(hass, COVER_DOMAIN, devices=[device])
config_entry.state = ConfigEntryState.LOADED
# Act
await hass.config_entries.async_forward_entry_unload(config_entry, COVER_DOMAIN)
# Assert