Fix resetting of attributes in EntityRegistry.async_get_or_create (#77516)

* Fix resetting of attributes in EntityRegistry.async_get_or_create

* Fix typing

* Fix resetting config entry

* Improve test

* Update tests
This commit is contained in:
Erik Montnemery
2022-08-30 21:07:50 +02:00
committed by GitHub
parent 67db380253
commit 4655ed995e
11 changed files with 151 additions and 114 deletions

View File

@@ -49,6 +49,8 @@ async def test_get_conditions(hass, device_reg, entity_reg, enable_custom_integr
"""Test we get the expected conditions from a binary_sensor."""
platform = getattr(hass.components, f"test.{DOMAIN}")
platform.init()
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {CONF_PLATFORM: "test"}})
await hass.async_block_till_done()
config_entry = MockConfigEntry(domain="test", data={})
config_entry.add_to_hass(hass)
@@ -64,9 +66,6 @@ async def test_get_conditions(hass, device_reg, entity_reg, enable_custom_integr
device_id=device_entry.id,
)
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {CONF_PLATFORM: "test"}})
await hass.async_block_till_done()
expected_conditions = [
{
"condition": "device",

View File

@@ -49,6 +49,8 @@ async def test_get_triggers(hass, device_reg, entity_reg, enable_custom_integrat
"""Test we get the expected triggers from a binary_sensor."""
platform = getattr(hass.components, f"test.{DOMAIN}")
platform.init()
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {CONF_PLATFORM: "test"}})
await hass.async_block_till_done()
config_entry = MockConfigEntry(domain="test", data={})
config_entry.add_to_hass(hass)
@@ -64,9 +66,6 @@ async def test_get_triggers(hass, device_reg, entity_reg, enable_custom_integrat
device_id=device_entry.id,
)
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {CONF_PLATFORM: "test"}})
await hass.async_block_till_done()
expected_triggers = [
{
"platform": "device",