1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Restore history from bluetooth stack at startup (#78612)

This commit is contained in:
J. Nick Koston
2022-09-17 16:58:19 -05:00
committed by GitHub
parent 13d3f4c3b2
commit 18eef5da1f
16 changed files with 151 additions and 55 deletions

View File

@@ -18,7 +18,11 @@ from tests.common import MockConfigEntry
async def test_options_flow_disabled_not_setup(
hass, hass_ws_client, mock_bleak_scanner_start, macos_adapter
hass,
hass_ws_client,
mock_bleak_scanner_start,
mock_bluetooth_adapters,
macos_adapter,
):
"""Test options are disabled if the integration has not been setup."""
await async_setup_component(hass, "config", {})
@@ -38,6 +42,7 @@ async def test_options_flow_disabled_not_setup(
)
response = await ws_client.receive_json()
assert response["result"][0]["supports_options"] is False
await hass.config_entries.async_unload(entry.entry_id)
async def test_async_step_user_macos(hass, macos_adapter):
@@ -262,7 +267,9 @@ async def test_async_step_integration_discovery_already_exists(hass):
assert result["reason"] == "already_configured"
async def test_options_flow_linux(hass, mock_bleak_scanner_start, one_adapter):
async def test_options_flow_linux(
hass, mock_bleak_scanner_start, mock_bluetooth_adapters, one_adapter
):
"""Test options on Linux."""
entry = MockConfigEntry(
domain=DOMAIN,
@@ -308,10 +315,15 @@ async def test_options_flow_linux(hass, mock_bleak_scanner_start, one_adapter):
assert result["type"] == FlowResultType.CREATE_ENTRY
assert result["data"][CONF_PASSIVE] is False
await hass.config_entries.async_unload(entry.entry_id)
async def test_options_flow_disabled_macos(
hass, hass_ws_client, mock_bleak_scanner_start, macos_adapter
hass,
hass_ws_client,
mock_bleak_scanner_start,
mock_bluetooth_adapters,
macos_adapter,
):
"""Test options are disabled on MacOS."""
await async_setup_component(hass, "config", {})
@@ -334,10 +346,11 @@ async def test_options_flow_disabled_macos(
)
response = await ws_client.receive_json()
assert response["result"][0]["supports_options"] is False
await hass.config_entries.async_unload(entry.entry_id)
async def test_options_flow_enabled_linux(
hass, hass_ws_client, mock_bleak_scanner_start, one_adapter
hass, hass_ws_client, mock_bleak_scanner_start, mock_bluetooth_adapters, one_adapter
):
"""Test options are enabled on Linux."""
await async_setup_component(hass, "config", {})
@@ -363,3 +376,4 @@ async def test_options_flow_enabled_linux(
)
response = await ws_client.receive_json()
assert response["result"][0]["supports_options"] is True
await hass.config_entries.async_unload(entry.entry_id)