diff --git a/tests/test_init.py b/tests/test_init.py index c4f05ea5b..a7fee7bcd 100644 --- a/tests/test_init.py +++ b/tests/test_init.py @@ -1,9 +1,15 @@ from homeassistant.components import input_boolean, light +from homeassistant.config_entries import ConfigEntryState +from homeassistant.const import ( + CONF_ENTITY_ID, + CONF_NAME, + CONF_UNIQUE_ID, + STATE_UNAVAILABLE, +) from homeassistant.core import HomeAssistant -from homeassistant.const import CONF_ENTITY_ID, CONF_NAME, CONF_UNIQUE_ID, STATE_UNAVAILABLE -from homeassistant.setup import async_setup_component from homeassistant.helpers.entity_registry import EntityRegistry -from homeassistant.config_entries import ConfigEntryState +from homeassistant.setup import async_setup_component +from pytest_homeassistant_custom_component.common import MockConfigEntry from custom_components.powercalc import create_domain_groups from custom_components.powercalc.const import ( @@ -27,7 +33,6 @@ run_powercalc_setup_yaml_config, ) -from pytest_homeassistant_custom_component.common import MockConfigEntry async def test_autodiscovery(hass: HomeAssistant): """Test that models are automatically discovered and power sensors created""" @@ -100,6 +105,7 @@ async def test_domain_groups(hass: HomeAssistant): assert not hass.states.get("sensor.all_light_power") + async def test_unload_entry(hass: HomeAssistant, entity_reg: EntityRegistry): unique_id = "98493943242" entry = MockConfigEntry( @@ -109,9 +115,7 @@ async def test_unload_entry(hass: HomeAssistant, entity_reg: EntityRegistry): CONF_UNIQUE_ID: unique_id, CONF_NAME: "testentry", CONF_ENTITY_ID: DUMMY_ENTITY_ID, - CONF_FIXED: { - CONF_POWER: 50 - } + CONF_FIXED: {CONF_POWER: 50}, }, unique_id=unique_id, ) @@ -128,4 +132,4 @@ async def test_unload_entry(hass: HomeAssistant, entity_reg: EntityRegistry): assert entry.state is ConfigEntryState.NOT_LOADED assert not hass.states.get("sensor.testentry_power") - assert not entity_reg.async_get("sensor.testentry_power") \ No newline at end of file + assert not entity_reg.async_get("sensor.testentry_power")