* Migrate cloud stt to config entry * Update default engine * Test config flow * Migrate pipelines with cloud stt engine to new engine id * Fix test after rebase * Update and add comment * Remove cloud specifics from default stt engine * Refactor cloud assist pipeline * Fix cloud stt entity_id * Try to wait for platforms before creating default pipeline * Clean up import * Move function in cloud assist pipeline * Wait for tts platform loaded in stt migration * Update deprecation dates * Clean up not used fixture * Add test for async_update_pipeline * Define pipeline update interface better * Remove leftover * Fix tests * Change default engine test * Add test for missing stt entity during login * Add and update comments * Update config entry title
40 lines
1.3 KiB
Python
40 lines
1.3 KiB
Python
"""Test the Home Assistant Cloud config flow."""
|
|
from unittest.mock import patch
|
|
|
|
from homeassistant.components.cloud.const import DOMAIN
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
from tests.common import MockConfigEntry
|
|
|
|
|
|
async def test_config_flow(hass: HomeAssistant) -> None:
|
|
"""Test create cloud entry."""
|
|
|
|
with patch(
|
|
"homeassistant.components.cloud.async_setup", return_value=True
|
|
) as mock_setup, patch(
|
|
"homeassistant.components.cloud.async_setup_entry",
|
|
return_value=True,
|
|
) as mock_setup_entry:
|
|
result = await hass.config_entries.flow.async_init(
|
|
DOMAIN, context={"source": "system"}
|
|
)
|
|
assert result["type"] == "create_entry"
|
|
assert result["title"] == "Home Assistant Cloud"
|
|
assert result["data"] == {}
|
|
await hass.async_block_till_done()
|
|
|
|
assert len(mock_setup.mock_calls) == 1
|
|
assert len(mock_setup_entry.mock_calls) == 1
|
|
|
|
|
|
async def test_multiple_entries(hass: HomeAssistant) -> None:
|
|
"""Test creating multiple cloud entries."""
|
|
config_entry = MockConfigEntry(domain=DOMAIN)
|
|
config_entry.add_to_hass(hass)
|
|
|
|
result = await hass.config_entries.flow.async_init(
|
|
DOMAIN, context={"source": "system"}
|
|
)
|
|
assert result["type"] == "abort"
|
|
assert result["reason"] == "single_instance_allowed"
|