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:
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user