mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Rename MQTT entry mock and cleanup (#91223)
Rename to mqtt_mock_entry and cleanup
This commit is contained in:
@@ -443,14 +443,14 @@ async def test_hassio_cannot_connect(
|
||||
|
||||
async def test_option_flow(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
mock_try_connection: MagicMock,
|
||||
) -> None:
|
||||
"""Test config flow options."""
|
||||
with patch(
|
||||
"homeassistant.config.async_hass_config_yaml", AsyncMock(return_value={})
|
||||
) as yaml_mock:
|
||||
mqtt_mock = await mqtt_mock_entry_no_yaml_config()
|
||||
mqtt_mock = await mqtt_mock_entry()
|
||||
mock_try_connection.return_value = True
|
||||
config_entry = hass.config_entries.async_entries(mqtt.DOMAIN)[0]
|
||||
config_entry.data = {
|
||||
@@ -540,7 +540,7 @@ async def test_option_flow(
|
||||
)
|
||||
async def test_bad_certificate(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
mock_try_connection_success: MqttMockPahoClient,
|
||||
mock_ssl_context: dict[str, MagicMock],
|
||||
mock_process_uploaded_file: MagicMock,
|
||||
@@ -577,7 +577,7 @@ async def test_bad_certificate(
|
||||
# Client key file without client cert, client cert without key file
|
||||
test_input.pop(mqtt.CONF_CLIENT_KEY)
|
||||
|
||||
mqtt_mock = await mqtt_mock_entry_no_yaml_config()
|
||||
mqtt_mock = await mqtt_mock_entry()
|
||||
mock_try_connection.return_value = True
|
||||
config_entry = hass.config_entries.async_entries(mqtt.DOMAIN)[0]
|
||||
# Add at least one advanced option to get the full form
|
||||
@@ -636,7 +636,7 @@ async def test_bad_certificate(
|
||||
)
|
||||
async def test_keepalive_validation(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
mock_try_connection: MagicMock,
|
||||
mock_reload_after_entry_update: MagicMock,
|
||||
input_value: str,
|
||||
@@ -650,7 +650,7 @@ async def test_keepalive_validation(
|
||||
mqtt.CONF_KEEPALIVE: input_value,
|
||||
}
|
||||
|
||||
mqtt_mock = await mqtt_mock_entry_no_yaml_config()
|
||||
mqtt_mock = await mqtt_mock_entry()
|
||||
mock_try_connection.return_value = True
|
||||
config_entry = hass.config_entries.async_entries(mqtt.DOMAIN)[0]
|
||||
# Add at least one advanced option to get the full form
|
||||
@@ -682,12 +682,12 @@ async def test_keepalive_validation(
|
||||
|
||||
async def test_disable_birth_will(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
mock_try_connection: MagicMock,
|
||||
mock_reload_after_entry_update: MagicMock,
|
||||
) -> None:
|
||||
"""Test disabling birth and will."""
|
||||
mqtt_mock = await mqtt_mock_entry_no_yaml_config()
|
||||
mqtt_mock = await mqtt_mock_entry()
|
||||
mock_try_connection.return_value = True
|
||||
config_entry = hass.config_entries.async_entries(mqtt.DOMAIN)[0]
|
||||
config_entry.data = {
|
||||
@@ -753,12 +753,12 @@ async def test_disable_birth_will(
|
||||
|
||||
async def test_invalid_discovery_prefix(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
mock_try_connection: MagicMock,
|
||||
mock_reload_after_entry_update: MagicMock,
|
||||
) -> None:
|
||||
"""Test setting an invalid discovery prefix."""
|
||||
mqtt_mock = await mqtt_mock_entry_no_yaml_config()
|
||||
mqtt_mock = await mqtt_mock_entry()
|
||||
mock_try_connection.return_value = True
|
||||
config_entry = hass.config_entries.async_entries(mqtt.DOMAIN)[0]
|
||||
config_entry.data = {
|
||||
@@ -832,12 +832,12 @@ def get_suggested(schema: vol.Schema, key: str) -> Any:
|
||||
|
||||
async def test_option_flow_default_suggested_values(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
mock_try_connection_success: MqttMockPahoClient,
|
||||
mock_reload_after_entry_update: MagicMock,
|
||||
) -> None:
|
||||
"""Test config flow options has default/suggested values."""
|
||||
await mqtt_mock_entry_no_yaml_config()
|
||||
await mqtt_mock_entry()
|
||||
config_entry = hass.config_entries.async_entries(mqtt.DOMAIN)[0]
|
||||
config_entry.data = {
|
||||
mqtt.CONF_BROKER: "test-broker",
|
||||
@@ -987,7 +987,7 @@ async def test_option_flow_default_suggested_values(
|
||||
)
|
||||
async def test_skipping_advanced_options(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
mock_try_connection: MagicMock,
|
||||
mock_reload_after_entry_update: MagicMock,
|
||||
advanced_options: bool,
|
||||
@@ -1001,7 +1001,7 @@ async def test_skipping_advanced_options(
|
||||
"advanced_options": advanced_options,
|
||||
}
|
||||
|
||||
mqtt_mock = await mqtt_mock_entry_no_yaml_config()
|
||||
mqtt_mock = await mqtt_mock_entry()
|
||||
mock_try_connection.return_value = True
|
||||
config_entry = hass.config_entries.async_entries(mqtt.DOMAIN)[0]
|
||||
# Initiate with a basic setup
|
||||
|
||||
Reference in New Issue
Block a user