Handle Bluetooth adapters in a crashed state (#115790)

* Skip bluetooth discovery for Bluetooth adapters in a crashed state

* fixes

* fixes

* adjust

* coverage

* coverage

* fix race
This commit is contained in:
J. Nick Koston
2024-04-18 15:06:53 -05:00
committed by GitHub
parent 05c37648c4
commit 1d6ae01baa
5 changed files with 103 additions and 1 deletions

View File

@@ -32,6 +32,9 @@ async def test_options_flow_disabled_not_setup(
domain=DOMAIN, data={}, options={}, unique_id=DEFAULT_ADDRESS
)
entry.add_to_hass(hass)
assert await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()
ws_client = await hass_ws_client(hass)
await ws_client.send_json(
@@ -103,6 +106,19 @@ async def test_async_step_user_linux_one_adapter(
assert len(mock_setup_entry.mock_calls) == 1
async def test_async_step_user_linux_crashed_adapter(
hass: HomeAssistant, crashed_adapter: None
) -> None:
"""Test setting up manually with one crashed adapter on Linux."""
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": config_entries.SOURCE_USER},
data={},
)
assert result["type"] is FlowResultType.ABORT
assert result["reason"] == "no_adapters"
async def test_async_step_user_linux_two_adapters(
hass: HomeAssistant, two_adapters: None
) -> None: