Remove cloud assist pipeline setup from cloud client (#92056)

This commit is contained in:
Erik Montnemery 2023-04-26 12:53:58 +02:00 committed by GitHub
parent 6b931b208f
commit ed737f306b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 119 additions and 133 deletions

View file

@ -155,17 +155,24 @@ async def test_on_connect(hass: HomeAssistant, mock_cloud_fixture) -> None:
assert len(hass.states.async_entity_ids("binary_sensor")) == 0
await cl.client.cloud_started()
# The on_start callback discovers the binary sensor platform
assert "async_setup" in str(cl._on_start[-1])
await cl._on_start[-1]()
await hass.async_block_till_done()
assert len(hass.states.async_entity_ids("binary_sensor")) == 1
with patch("homeassistant.helpers.discovery.async_load_platform") as mock_load:
await cl.iot._on_connect[-1]()
await cl._on_start[-1]()
await hass.async_block_till_done()
assert len(mock_load.mock_calls) == 0
assert len(cloud_states) == 1
assert cloud_states[-1] == cloud.CloudConnectionState.CLOUD_CONNECTED
await cl.iot._on_connect[-1]()
await hass.async_block_till_done()
assert len(cloud_states) == 2
assert cloud_states[-1] == cloud.CloudConnectionState.CLOUD_CONNECTED
@ -177,6 +184,11 @@ async def test_on_connect(hass: HomeAssistant, mock_cloud_fixture) -> None:
assert len(cloud_states) == 3
assert cloud_states[-1] == cloud.CloudConnectionState.CLOUD_DISCONNECTED
await cl.iot._on_disconnect[-1]()
await hass.async_block_till_done()
assert len(cloud_states) == 4
assert cloud_states[-1] == cloud.CloudConnectionState.CLOUD_DISCONNECTED
async def test_remote_ui_url(hass: HomeAssistant, mock_cloud_fixture) -> None:
"""Test getting remote ui url."""