1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-23 20:39:01 +00:00

Remove strict connection (#117933)

This commit is contained in:
Robert Resch
2024-05-24 15:50:22 +02:00
committed by GitHub
parent 6f81852eb4
commit cb62f4242e
32 changed files with 39 additions and 1816 deletions

View File

@@ -6,13 +6,8 @@ from unittest.mock import ANY, MagicMock, patch
import pytest
from homeassistant.auth.const import GROUP_ID_ADMIN
from homeassistant.components.cloud.const import (
DOMAIN,
PREF_STRICT_CONNECTION,
PREF_TTS_DEFAULT_VOICE,
)
from homeassistant.components.cloud.const import DOMAIN, PREF_TTS_DEFAULT_VOICE
from homeassistant.components.cloud.prefs import STORAGE_KEY, CloudPreferences
from homeassistant.components.http.const import StrictConnectionMode
from homeassistant.core import HomeAssistant
from homeassistant.setup import async_setup_component
@@ -179,39 +174,3 @@ async def test_tts_default_voice_legacy_gender(
await hass.async_block_till_done()
assert cloud.client.prefs.tts_default_voice == (expected_language, voice)
@pytest.mark.parametrize("mode", list(StrictConnectionMode))
async def test_strict_connection_convertion(
hass: HomeAssistant,
cloud: MagicMock,
hass_storage: dict[str, Any],
mode: StrictConnectionMode,
) -> None:
"""Test strict connection string value will be converted to the enum."""
hass_storage[STORAGE_KEY] = {
"version": 1,
"data": {PREF_STRICT_CONNECTION: mode.value},
}
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {}})
await hass.async_block_till_done()
assert cloud.client.prefs.strict_connection is mode
@pytest.mark.parametrize("storage_data", [{}, {PREF_STRICT_CONNECTION: None}])
async def test_strict_connection_default(
hass: HomeAssistant,
cloud: MagicMock,
hass_storage: dict[str, Any],
storage_data: dict[str, Any],
) -> None:
"""Test strict connection default values."""
hass_storage[STORAGE_KEY] = {
"version": 1,
"data": storage_data,
}
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {}})
await hass.async_block_till_done()
assert cloud.client.prefs.strict_connection is StrictConnectionMode.DISABLED