Fix race in gardena_bluetooth config flow tests (#111042)

pull/111045/head
J. Nick Koston 2024-02-20 16:08:06 -06:00 committed by GitHub
parent 5b00703ef7
commit 145c6163a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 12 deletions

View File

@ -1,17 +1,17 @@
# serializer version: 1 # serializer version: 1
# name: test_bluetooth # name: test_bluetooth
FlowResultSnapshot({ FlowResultSnapshot({
'data_schema': None, 'context': dict({
'description_placeholders': dict({ 'confirm_only': True,
'name': 'Gardena Water Computer', 'source': 'bluetooth',
'title_placeholders': dict({
'name': 'Gardena Water Computer',
}),
'unique_id': '00000000-0000-0000-0000-000000000001',
}), }),
'errors': None,
'flow_id': <ANY>, 'flow_id': <ANY>,
'handler': 'gardena_bluetooth', 'handler': 'gardena_bluetooth',
'last_step': None,
'preview': None,
'step_id': 'confirm', 'step_id': 'confirm',
'type': <FlowResultType.FORM: 'form'>,
}) })
# --- # ---
# name: test_bluetooth.1 # name: test_bluetooth.1

View File

@ -100,13 +100,12 @@ async def test_bluetooth(
) -> None: ) -> None:
"""Test bluetooth device discovery.""" """Test bluetooth device discovery."""
# Inject the service info will trigger the flow to start
inject_bluetooth_service_info(hass, WATER_TIMER_SERVICE_INFO) inject_bluetooth_service_info(hass, WATER_TIMER_SERVICE_INFO)
await hass.async_block_till_done()
result = next(iter(hass.config_entries.flow.async_progress_by_handler(DOMAIN)))
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": config_entries.SOURCE_BLUETOOTH},
data=WATER_TIMER_SERVICE_INFO,
)
assert result == snapshot assert result == snapshot
result = await hass.config_entries.flow.async_configure( result = await hass.config_entries.flow.async_configure(