Fix defaults for cloud STT/TTS (#121229)

* Fix defaults for cloud STT/TTS

* Prefer entity over legacy provider

* Remove unrealistic tests

* Add tests which show cloud stt/tts entity is preferred

---------

Co-authored-by: Erik <erik@montnemery.com>
This commit is contained in:
Paulus Schoutsen 2024-08-26 19:39:09 +02:00 committed by GitHub
parent 547dbf77aa
commit 156948c496
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 144 additions and 34 deletions

View file

@ -215,7 +215,9 @@ async def mock_setup(
async def mock_config_entry_setup(
hass: HomeAssistant, tts_entity: MockTTSEntity
hass: HomeAssistant,
tts_entity: MockTTSEntity,
test_domain: str = TEST_DOMAIN,
) -> MockConfigEntry:
"""Set up a test tts platform via config entry."""
@ -236,7 +238,7 @@ async def mock_config_entry_setup(
mock_integration(
hass,
MockModule(
TEST_DOMAIN,
test_domain,
async_setup_entry=async_setup_entry_init,
async_unload_entry=async_unload_entry_init,
),
@ -251,9 +253,9 @@ async def mock_config_entry_setup(
async_add_entities([tts_entity])
loaded_platform = MockPlatform(async_setup_entry=async_setup_entry_platform)
mock_platform(hass, f"{TEST_DOMAIN}.{TTS_DOMAIN}", loaded_platform)
mock_platform(hass, f"{test_domain}.{TTS_DOMAIN}", loaded_platform)
config_entry = MockConfigEntry(domain=TEST_DOMAIN)
config_entry = MockConfigEntry(domain=test_domain)
config_entry.add_to_hass(hass)
assert await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()