mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Cleanup mqtt platform tests part 2 (#120490)
This commit is contained in:
parent
cef1d35e31
commit
fab901f9b6
@ -697,9 +697,7 @@ async def test_position_via_template_and_entity_id(
|
||||
],
|
||||
)
|
||||
async def test_optimistic_flag(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
assumed_state: bool,
|
||||
hass: HomeAssistant, mqtt_mock_entry: MqttMockHAClientGenerator, assumed_state: bool
|
||||
) -> None:
|
||||
"""Test assumed_state is set correctly."""
|
||||
await mqtt_mock_entry()
|
||||
@ -1073,10 +1071,9 @@ async def test_current_cover_position_inverted(
|
||||
}
|
||||
],
|
||||
)
|
||||
@pytest.mark.usefixtures("hass")
|
||||
async def test_optimistic_position(
|
||||
hass: HomeAssistant,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
caplog: pytest.LogCaptureFixture, mqtt_mock_entry: MqttMockHAClientGenerator
|
||||
) -> None:
|
||||
"""Test optimistic position is not supported."""
|
||||
assert await mqtt_mock_entry()
|
||||
@ -1627,7 +1624,6 @@ async def test_tilt_via_invocation_defaults(
|
||||
hass: HomeAssistant, mqtt_mock_entry: MqttMockHAClientGenerator
|
||||
) -> None:
|
||||
"""Test tilt defaults on close/open."""
|
||||
await hass.async_block_till_done()
|
||||
mqtt_mock = await mqtt_mock_entry()
|
||||
|
||||
await hass.services.async_call(
|
||||
@ -2547,11 +2543,7 @@ async def test_update_with_json_attrs_not_dict(
|
||||
) -> None:
|
||||
"""Test attributes get extracted from a JSON result."""
|
||||
await help_test_update_with_json_attrs_not_dict(
|
||||
hass,
|
||||
mqtt_mock_entry,
|
||||
caplog,
|
||||
cover.DOMAIN,
|
||||
DEFAULT_CONFIG,
|
||||
hass, mqtt_mock_entry, caplog, cover.DOMAIN, DEFAULT_CONFIG
|
||||
)
|
||||
|
||||
|
||||
@ -2562,11 +2554,7 @@ async def test_update_with_json_attrs_bad_json(
|
||||
) -> None:
|
||||
"""Test attributes get extracted from a JSON result."""
|
||||
await help_test_update_with_json_attrs_bad_json(
|
||||
hass,
|
||||
mqtt_mock_entry,
|
||||
caplog,
|
||||
cover.DOMAIN,
|
||||
DEFAULT_CONFIG,
|
||||
hass, mqtt_mock_entry, caplog, cover.DOMAIN, DEFAULT_CONFIG
|
||||
)
|
||||
|
||||
|
||||
@ -3221,10 +3209,9 @@ async def test_position_via_position_topic_template_return_invalid_json(
|
||||
}
|
||||
],
|
||||
)
|
||||
@pytest.mark.usefixtures("hass")
|
||||
async def test_set_position_topic_without_get_position_topic_error(
|
||||
hass: HomeAssistant,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
caplog: pytest.LogCaptureFixture, mqtt_mock_entry: MqttMockHAClientGenerator
|
||||
) -> None:
|
||||
"""Test error when set_position_topic is used without position_topic."""
|
||||
assert await mqtt_mock_entry()
|
||||
@ -3247,8 +3234,8 @@ async def test_set_position_topic_without_get_position_topic_error(
|
||||
}
|
||||
],
|
||||
)
|
||||
@pytest.mark.usefixtures("hass")
|
||||
async def test_value_template_without_state_topic_error(
|
||||
hass: HomeAssistant,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
) -> None:
|
||||
@ -3273,8 +3260,8 @@ async def test_value_template_without_state_topic_error(
|
||||
}
|
||||
],
|
||||
)
|
||||
@pytest.mark.usefixtures("hass")
|
||||
async def test_position_template_without_position_topic_error(
|
||||
hass: HomeAssistant,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
) -> None:
|
||||
@ -3300,10 +3287,9 @@ async def test_position_template_without_position_topic_error(
|
||||
}
|
||||
],
|
||||
)
|
||||
@pytest.mark.usefixtures("hass")
|
||||
async def test_set_position_template_without_set_position_topic(
|
||||
hass: HomeAssistant,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
caplog: pytest.LogCaptureFixture, mqtt_mock_entry: MqttMockHAClientGenerator
|
||||
) -> None:
|
||||
"""Test error when set_position_template is used and set_position_topic is missing."""
|
||||
assert await mqtt_mock_entry()
|
||||
@ -3327,10 +3313,9 @@ async def test_set_position_template_without_set_position_topic(
|
||||
}
|
||||
],
|
||||
)
|
||||
@pytest.mark.usefixtures("hass")
|
||||
async def test_tilt_command_template_without_tilt_command_topic(
|
||||
hass: HomeAssistant,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
caplog: pytest.LogCaptureFixture, mqtt_mock_entry: MqttMockHAClientGenerator
|
||||
) -> None:
|
||||
"""Test error when tilt_command_template is used and tilt_command_topic is missing."""
|
||||
assert await mqtt_mock_entry()
|
||||
@ -3354,10 +3339,9 @@ async def test_tilt_command_template_without_tilt_command_topic(
|
||||
}
|
||||
],
|
||||
)
|
||||
@pytest.mark.usefixtures("hass")
|
||||
async def test_tilt_status_template_without_tilt_status_topic_topic(
|
||||
hass: HomeAssistant,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
caplog: pytest.LogCaptureFixture, mqtt_mock_entry: MqttMockHAClientGenerator
|
||||
) -> None:
|
||||
"""Test error when tilt_status_template is used and tilt_status_topic is missing."""
|
||||
assert await mqtt_mock_entry()
|
||||
@ -3423,8 +3407,7 @@ async def test_publishing_with_custom_encoding(
|
||||
|
||||
|
||||
async def test_reloadable(
|
||||
hass: HomeAssistant,
|
||||
mqtt_client_mock: MqttMockPahoClient,
|
||||
hass: HomeAssistant, mqtt_client_mock: MqttMockPahoClient
|
||||
) -> None:
|
||||
"""Test reloading the MQTT platform."""
|
||||
domain = cover.DOMAIN
|
||||
|
@ -334,9 +334,7 @@ async def test_setting_device_tracker_value_via_mqtt_message(
|
||||
|
||||
|
||||
async def test_setting_device_tracker_value_via_mqtt_message_and_template(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
hass: HomeAssistant, mqtt_mock_entry: MqttMockHAClientGenerator
|
||||
) -> None:
|
||||
"""Test the setting of the value via MQTT."""
|
||||
await mqtt_mock_entry()
|
||||
@ -361,9 +359,7 @@ async def test_setting_device_tracker_value_via_mqtt_message_and_template(
|
||||
|
||||
|
||||
async def test_setting_device_tracker_value_via_mqtt_message_and_template2(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
hass: HomeAssistant, mqtt_mock_entry: MqttMockHAClientGenerator
|
||||
) -> None:
|
||||
"""Test the setting of the value via MQTT."""
|
||||
await mqtt_mock_entry()
|
||||
@ -391,9 +387,7 @@ async def test_setting_device_tracker_value_via_mqtt_message_and_template2(
|
||||
|
||||
|
||||
async def test_setting_device_tracker_location_via_mqtt_message(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
hass: HomeAssistant, mqtt_mock_entry: MqttMockHAClientGenerator
|
||||
) -> None:
|
||||
"""Test the setting of the location via MQTT."""
|
||||
await mqtt_mock_entry()
|
||||
@ -415,9 +409,7 @@ async def test_setting_device_tracker_location_via_mqtt_message(
|
||||
|
||||
|
||||
async def test_setting_device_tracker_location_via_lat_lon_message(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
hass: HomeAssistant, mqtt_mock_entry: MqttMockHAClientGenerator
|
||||
) -> None:
|
||||
"""Test the setting of the latitude and longitude via MQTT without state topic."""
|
||||
await mqtt_mock_entry()
|
||||
@ -472,9 +464,7 @@ async def test_setting_device_tracker_location_via_lat_lon_message(
|
||||
|
||||
|
||||
async def test_setting_device_tracker_location_via_reset_message(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
hass: HomeAssistant, mqtt_mock_entry: MqttMockHAClientGenerator
|
||||
) -> None:
|
||||
"""Test the automatic inference of zones via MQTT via reset."""
|
||||
await mqtt_mock_entry()
|
||||
@ -548,9 +538,7 @@ async def test_setting_device_tracker_location_via_reset_message(
|
||||
|
||||
|
||||
async def test_setting_device_tracker_location_via_abbr_reset_message(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
hass: HomeAssistant, mqtt_mock_entry: MqttMockHAClientGenerator
|
||||
) -> None:
|
||||
"""Test the setting of reset via abbreviated names and custom payloads via MQTT."""
|
||||
await mqtt_mock_entry()
|
||||
@ -625,8 +613,7 @@ async def test_setup_with_modern_schema(
|
||||
|
||||
|
||||
async def test_reloadable(
|
||||
hass: HomeAssistant,
|
||||
mqtt_client_mock: MqttMockPahoClient,
|
||||
hass: HomeAssistant, mqtt_client_mock: MqttMockPahoClient
|
||||
) -> None:
|
||||
"""Test reloading the MQTT platform."""
|
||||
domain = device_tracker.DOMAIN
|
||||
|
@ -1,6 +1,7 @@
|
||||
"""The tests for MQTT device triggers."""
|
||||
|
||||
import json
|
||||
from typing import Any
|
||||
|
||||
import pytest
|
||||
from pytest_unordered import unordered
|
||||
@ -194,7 +195,6 @@ async def test_update_remove_triggers(
|
||||
hass: HomeAssistant,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
) -> None:
|
||||
"""Test triggers can be updated and removed."""
|
||||
await mqtt_mock_entry()
|
||||
@ -1016,10 +1016,10 @@ async def test_attach_remove(
|
||||
await hass.async_block_till_done()
|
||||
device_entry = device_registry.async_get_device(identifiers={("mqtt", "0AFFD2")})
|
||||
|
||||
calls = []
|
||||
callback_calls: list[dict[str, Any]] = []
|
||||
|
||||
def callback(trigger):
|
||||
calls.append(trigger["trigger"]["payload"])
|
||||
def trigger_callback(trigger):
|
||||
callback_calls.append(trigger["trigger"]["payload"])
|
||||
|
||||
remove = await async_initialize_triggers(
|
||||
hass,
|
||||
@ -1033,7 +1033,7 @@ async def test_attach_remove(
|
||||
"subtype": "button_1",
|
||||
},
|
||||
],
|
||||
callback,
|
||||
trigger_callback,
|
||||
DOMAIN,
|
||||
"mock-name",
|
||||
_LOGGER.log,
|
||||
@ -1042,8 +1042,8 @@ async def test_attach_remove(
|
||||
# Fake short press.
|
||||
async_fire_mqtt_message(hass, "foobar/triggers/button1", "short_press")
|
||||
await hass.async_block_till_done()
|
||||
assert len(calls) == 1
|
||||
assert calls[0] == "short_press"
|
||||
assert len(callback_calls) == 1
|
||||
assert callback_calls[0] == "short_press"
|
||||
|
||||
# Remove the trigger
|
||||
remove()
|
||||
@ -1052,7 +1052,7 @@ async def test_attach_remove(
|
||||
# Verify the triggers are no longer active
|
||||
async_fire_mqtt_message(hass, "foobar/triggers/button1", "short_press")
|
||||
await hass.async_block_till_done()
|
||||
assert len(calls) == 1
|
||||
assert len(callback_calls) == 1
|
||||
|
||||
|
||||
async def test_attach_remove_late(
|
||||
@ -1079,10 +1079,10 @@ async def test_attach_remove_late(
|
||||
await hass.async_block_till_done()
|
||||
device_entry = device_registry.async_get_device(identifiers={("mqtt", "0AFFD2")})
|
||||
|
||||
calls = []
|
||||
callback_calls: list[dict[str, Any]] = []
|
||||
|
||||
def callback(trigger):
|
||||
calls.append(trigger["trigger"]["payload"])
|
||||
def trigger_callback(trigger):
|
||||
callback_calls.append(trigger["trigger"]["payload"])
|
||||
|
||||
remove = await async_initialize_triggers(
|
||||
hass,
|
||||
@ -1096,7 +1096,7 @@ async def test_attach_remove_late(
|
||||
"subtype": "button_1",
|
||||
},
|
||||
],
|
||||
callback,
|
||||
trigger_callback,
|
||||
DOMAIN,
|
||||
"mock-name",
|
||||
_LOGGER.log,
|
||||
@ -1108,8 +1108,8 @@ async def test_attach_remove_late(
|
||||
# Fake short press.
|
||||
async_fire_mqtt_message(hass, "foobar/triggers/button1", "short_press")
|
||||
await hass.async_block_till_done()
|
||||
assert len(calls) == 1
|
||||
assert calls[0] == "short_press"
|
||||
assert len(callback_calls) == 1
|
||||
assert callback_calls[0] == "short_press"
|
||||
|
||||
# Remove the trigger
|
||||
remove()
|
||||
@ -1118,7 +1118,7 @@ async def test_attach_remove_late(
|
||||
# Verify the triggers are no longer active
|
||||
async_fire_mqtt_message(hass, "foobar/triggers/button1", "short_press")
|
||||
await hass.async_block_till_done()
|
||||
assert len(calls) == 1
|
||||
assert len(callback_calls) == 1
|
||||
|
||||
|
||||
async def test_attach_remove_late2(
|
||||
@ -1145,10 +1145,10 @@ async def test_attach_remove_late2(
|
||||
await hass.async_block_till_done()
|
||||
device_entry = device_registry.async_get_device(identifiers={("mqtt", "0AFFD2")})
|
||||
|
||||
calls = []
|
||||
callback_calls: list[dict[str, Any]] = []
|
||||
|
||||
def callback(trigger):
|
||||
calls.append(trigger["trigger"]["payload"])
|
||||
def trigger_callback(trigger):
|
||||
callback_calls.append(trigger["trigger"]["payload"])
|
||||
|
||||
remove = await async_initialize_triggers(
|
||||
hass,
|
||||
@ -1162,7 +1162,7 @@ async def test_attach_remove_late2(
|
||||
"subtype": "button_1",
|
||||
},
|
||||
],
|
||||
callback,
|
||||
trigger_callback,
|
||||
DOMAIN,
|
||||
"mock-name",
|
||||
_LOGGER.log,
|
||||
@ -1178,7 +1178,7 @@ async def test_attach_remove_late2(
|
||||
# Verify the triggers are no longer active
|
||||
async_fire_mqtt_message(hass, "foobar/triggers/button1", "short_press")
|
||||
await hass.async_block_till_done()
|
||||
assert len(calls) == 0
|
||||
assert len(callback_calls) == 0
|
||||
|
||||
# Try to remove the trigger twice
|
||||
with pytest.raises(HomeAssistantError):
|
||||
|
@ -26,7 +26,6 @@ default_config = {
|
||||
async def test_entry_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
entity_registry: er.EntityRegistry,
|
||||
hass_client: ClientSessionGenerator,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
) -> None:
|
||||
|
@ -64,8 +64,7 @@ from tests.typing import (
|
||||
[{mqtt.CONF_BROKER: "mock-broker", mqtt.CONF_DISCOVERY: False}],
|
||||
)
|
||||
async def test_subscribing_config_topic(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
hass: HomeAssistant, mqtt_mock_entry: MqttMockHAClientGenerator
|
||||
) -> None:
|
||||
"""Test setting up discovery."""
|
||||
mqtt_mock = await mqtt_mock_entry()
|
||||
@ -205,8 +204,7 @@ async def test_only_valid_components(
|
||||
|
||||
|
||||
async def test_correct_config_discovery(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
hass: HomeAssistant, mqtt_mock_entry: MqttMockHAClientGenerator
|
||||
) -> None:
|
||||
"""Test sending in correct JSON."""
|
||||
await mqtt_mock_entry()
|
||||
@ -285,9 +283,7 @@ async def test_discovery_with_invalid_integration_info(
|
||||
"""Test sending in correct JSON."""
|
||||
await mqtt_mock_entry()
|
||||
async_fire_mqtt_message(
|
||||
hass,
|
||||
"homeassistant/binary_sensor/bla/config",
|
||||
config_message,
|
||||
hass, "homeassistant/binary_sensor/bla/config", config_message
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
@ -298,8 +294,7 @@ async def test_discovery_with_invalid_integration_info(
|
||||
|
||||
|
||||
async def test_discover_fan(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
hass: HomeAssistant, mqtt_mock_entry: MqttMockHAClientGenerator
|
||||
) -> None:
|
||||
"""Test discovering an MQTT fan."""
|
||||
await mqtt_mock_entry()
|
||||
@ -318,9 +313,7 @@ async def test_discover_fan(
|
||||
|
||||
|
||||
async def test_discover_climate(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
hass: HomeAssistant, mqtt_mock_entry: MqttMockHAClientGenerator
|
||||
) -> None:
|
||||
"""Test discovering an MQTT climate component."""
|
||||
await mqtt_mock_entry()
|
||||
@ -341,8 +334,7 @@ async def test_discover_climate(
|
||||
|
||||
|
||||
async def test_discover_alarm_control_panel(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
hass: HomeAssistant, mqtt_mock_entry: MqttMockHAClientGenerator
|
||||
) -> None:
|
||||
"""Test discovering an MQTT alarm control panel component."""
|
||||
await mqtt_mock_entry()
|
||||
@ -531,8 +523,7 @@ async def test_discovery_with_object_id(
|
||||
|
||||
|
||||
async def test_discovery_incl_nodeid(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
hass: HomeAssistant, mqtt_mock_entry: MqttMockHAClientGenerator
|
||||
) -> None:
|
||||
"""Test sending in correct JSON with optional node_id included."""
|
||||
await mqtt_mock_entry()
|
||||
@ -581,8 +572,7 @@ async def test_non_duplicate_discovery(
|
||||
|
||||
|
||||
async def test_removal(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
hass: HomeAssistant, mqtt_mock_entry: MqttMockHAClientGenerator
|
||||
) -> None:
|
||||
"""Test removal of component through empty discovery message."""
|
||||
await mqtt_mock_entry()
|
||||
@ -602,8 +592,7 @@ async def test_removal(
|
||||
|
||||
|
||||
async def test_rediscover(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
hass: HomeAssistant, mqtt_mock_entry: MqttMockHAClientGenerator
|
||||
) -> None:
|
||||
"""Test rediscover of removed component."""
|
||||
await mqtt_mock_entry()
|
||||
@ -632,8 +621,7 @@ async def test_rediscover(
|
||||
|
||||
|
||||
async def test_rapid_rediscover(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
hass: HomeAssistant, mqtt_mock_entry: MqttMockHAClientGenerator
|
||||
) -> None:
|
||||
"""Test immediate rediscover of removed component."""
|
||||
await mqtt_mock_entry()
|
||||
@ -684,8 +672,7 @@ async def test_rapid_rediscover(
|
||||
|
||||
|
||||
async def test_rapid_rediscover_unique(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
hass: HomeAssistant, mqtt_mock_entry: MqttMockHAClientGenerator
|
||||
) -> None:
|
||||
"""Test immediate rediscover of removed component."""
|
||||
await mqtt_mock_entry()
|
||||
@ -746,8 +733,7 @@ async def test_rapid_rediscover_unique(
|
||||
|
||||
|
||||
async def test_rapid_reconfigure(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
hass: HomeAssistant, mqtt_mock_entry: MqttMockHAClientGenerator
|
||||
) -> None:
|
||||
"""Test immediate reconfigure of added component."""
|
||||
await mqtt_mock_entry()
|
||||
@ -1110,8 +1096,7 @@ async def test_cleanup_device_multiple_config_entries_mqtt(
|
||||
|
||||
|
||||
async def test_discovery_expansion(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
hass: HomeAssistant, mqtt_mock_entry: MqttMockHAClientGenerator
|
||||
) -> None:
|
||||
"""Test expansion of abbreviated discovery payload."""
|
||||
await mqtt_mock_entry()
|
||||
@ -1172,8 +1157,7 @@ async def test_discovery_expansion(
|
||||
|
||||
|
||||
async def test_discovery_expansion_2(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
hass: HomeAssistant, mqtt_mock_entry: MqttMockHAClientGenerator
|
||||
) -> None:
|
||||
"""Test expansion of abbreviated discovery payload."""
|
||||
await mqtt_mock_entry()
|
||||
@ -1249,8 +1233,7 @@ async def test_discovery_expansion_3(
|
||||
|
||||
|
||||
async def test_discovery_expansion_without_encoding_and_value_template_1(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
hass: HomeAssistant, mqtt_mock_entry: MqttMockHAClientGenerator
|
||||
) -> None:
|
||||
"""Test expansion of raw availability payload with a template as list."""
|
||||
await mqtt_mock_entry()
|
||||
@ -1300,8 +1283,7 @@ async def test_discovery_expansion_without_encoding_and_value_template_1(
|
||||
|
||||
|
||||
async def test_discovery_expansion_without_encoding_and_value_template_2(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
hass: HomeAssistant, mqtt_mock_entry: MqttMockHAClientGenerator
|
||||
) -> None:
|
||||
"""Test expansion of raw availability payload with a template directly."""
|
||||
await mqtt_mock_entry()
|
||||
@ -1379,7 +1361,6 @@ EXCLUDED_MODULES = {
|
||||
|
||||
|
||||
async def test_missing_discover_abbreviations(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
) -> None:
|
||||
"""Check MQTT platforms for missing abbreviations."""
|
||||
@ -1403,8 +1384,7 @@ async def test_missing_discover_abbreviations(
|
||||
|
||||
|
||||
async def test_no_implicit_state_topic_switch(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
hass: HomeAssistant, mqtt_mock_entry: MqttMockHAClientGenerator
|
||||
) -> None:
|
||||
"""Test no implicit state topic for switch."""
|
||||
await mqtt_mock_entry()
|
||||
@ -1462,8 +1442,7 @@ async def test_complex_discovery_topic_prefix(
|
||||
@patch("homeassistant.components.mqtt.client.SUBSCRIBE_COOLDOWN", 0.0)
|
||||
@patch("homeassistant.components.mqtt.client.UNSUBSCRIBE_COOLDOWN", 0.0)
|
||||
async def test_mqtt_integration_discovery_subscribe_unsubscribe(
|
||||
hass: HomeAssistant,
|
||||
mqtt_client_mock: MqttMockPahoClient,
|
||||
hass: HomeAssistant, mqtt_client_mock: MqttMockPahoClient
|
||||
) -> None:
|
||||
"""Check MQTT integration discovery subscribe and unsubscribe."""
|
||||
|
||||
@ -1521,8 +1500,7 @@ async def test_mqtt_integration_discovery_subscribe_unsubscribe(
|
||||
@patch("homeassistant.components.mqtt.client.SUBSCRIBE_COOLDOWN", 0.0)
|
||||
@patch("homeassistant.components.mqtt.client.UNSUBSCRIBE_COOLDOWN", 0.0)
|
||||
async def test_mqtt_discovery_unsubscribe_once(
|
||||
hass: HomeAssistant,
|
||||
mqtt_client_mock: MqttMockPahoClient,
|
||||
hass: HomeAssistant, mqtt_client_mock: MqttMockPahoClient
|
||||
) -> None:
|
||||
"""Check MQTT integration discovery unsubscribe once."""
|
||||
|
||||
@ -1657,7 +1635,6 @@ async def test_clean_up_registry_monitoring(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test registry monitoring hook is removed after a reload."""
|
||||
await mqtt_mock_entry()
|
||||
|
@ -325,10 +325,9 @@ async def test_discovery_update_availability(
|
||||
}
|
||||
],
|
||||
)
|
||||
@pytest.mark.usefixtures("hass")
|
||||
async def test_invalid_device_class(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator, caplog: pytest.LogCaptureFixture
|
||||
) -> None:
|
||||
"""Test device_class option with invalid value."""
|
||||
assert await mqtt_mock_entry()
|
||||
@ -444,9 +443,7 @@ async def test_discovery_removal_event(
|
||||
|
||||
|
||||
async def test_discovery_update_event_template(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
hass: HomeAssistant, mqtt_mock_entry: MqttMockHAClientGenerator
|
||||
) -> None:
|
||||
"""Test update of discovered mqtt event template."""
|
||||
await mqtt_mock_entry()
|
||||
@ -665,8 +662,7 @@ async def test_value_template_with_entity_id(
|
||||
|
||||
|
||||
async def test_reloadable(
|
||||
hass: HomeAssistant,
|
||||
mqtt_client_mock: MqttMockPahoClient,
|
||||
hass: HomeAssistant, mqtt_client_mock: MqttMockPahoClient
|
||||
) -> None:
|
||||
"""Test reloading the MQTT platform."""
|
||||
domain = event.DOMAIN
|
||||
@ -689,8 +685,7 @@ async def test_setup_manual_entity_from_yaml(
|
||||
|
||||
|
||||
async def test_unload_entry(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
hass: HomeAssistant, mqtt_mock_entry: MqttMockHAClientGenerator
|
||||
) -> None:
|
||||
"""Test unloading the config entry."""
|
||||
domain = event.DOMAIN
|
||||
|
Loading…
x
Reference in New Issue
Block a user