Assert the MQTT config entry is reloaded on subentry creation and mutation (#150636)

This commit is contained in:
Jan Bouwhuis
2025-08-15 13:04:12 +02:00
committed by GitHub
parent 83ee380b17
commit 7bd126dc8e

View File

@@ -3367,6 +3367,7 @@ async def test_migrate_of_incompatible_config_entry(
async def test_subentry_configflow( async def test_subentry_configflow(
hass: HomeAssistant, hass: HomeAssistant,
mqtt_mock_entry: MqttMockHAClientGenerator, mqtt_mock_entry: MqttMockHAClientGenerator,
mock_reload_after_entry_update: MagicMock,
config_subentries_data: dict[str, Any], config_subentries_data: dict[str, Any],
mock_device_user_input: dict[str, Any], mock_device_user_input: dict[str, Any],
mock_entity_user_input: dict[str, Any], mock_entity_user_input: dict[str, Any],
@@ -3501,6 +3502,10 @@ async def test_subentry_configflow(
assert subentry_device_data[option] == value assert subentry_device_data[option] == value
await hass.async_block_till_done() await hass.async_block_till_done()
await hass.async_block_till_done(wait_background_tasks=True)
# Assert the entry is reloaded to set up the entity
assert len(mock_reload_after_entry_update.mock_calls) == 1
@pytest.mark.parametrize( @pytest.mark.parametrize(
@@ -3641,6 +3646,7 @@ async def test_subentry_reconfigure_remove_entity(
async def test_subentry_reconfigure_edit_entity_multi_entitites( async def test_subentry_reconfigure_edit_entity_multi_entitites(
hass: HomeAssistant, hass: HomeAssistant,
mqtt_mock_entry: MqttMockHAClientGenerator, mqtt_mock_entry: MqttMockHAClientGenerator,
mock_reload_after_entry_update: MagicMock,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
user_input_mqtt: dict[str, Any], user_input_mqtt: dict[str, Any],
@@ -3758,6 +3764,10 @@ async def test_subentry_reconfigure_edit_entity_multi_entitites(
for key, value in user_input_mqtt.items(): for key, value in user_input_mqtt.items():
assert new_components[object_list[1]][key] == value assert new_components[object_list[1]][key] == value
# Assert the entry is reloaded to set up the entity
await hass.async_block_till_done(wait_background_tasks=True)
assert len(mock_reload_after_entry_update.mock_calls) == 1
@pytest.mark.parametrize( @pytest.mark.parametrize(
( (