mirror of
https://github.com/home-assistant/core.git
synced 2025-08-01 03:35:09 +02:00
Update MQTT tests to use the config entry setup (#72373)
* New testframework and tests for fan platform * Merge test_common_new to test_common * Add alarm_control_panel * Add binary_sensor * Add button * Add camera * Add climate * Add config_flow * Add cover * Add device_tracker_disovery * Add device_trigger * Add diagnostics * Add discovery * Add humidifier * Add init * Add lecacy_vacuum * Add light_json * Add light_template * Add light * Add lock * Add number * Add scene * Add select * Add sensor * Add siren * Add state_vacuum * Add subscription * Add switch * Add tag * Add trigger * Add missed tests * Add another missed test * Add device_tracker * Remove commented out code * Correct tests according comments * Improve mqtt_mock_entry and recover tests * Split fixtures with and without yaml setup * Update fixtures manual_mqtt * Update fixtures mqtt_json * Fix test tasmota * Update fixture mqtt_room * Revert fixture changes, improve test * re-add test
This commit is contained in:
@@ -70,7 +70,7 @@ async def async_turn_off(hass, entity_id=ENTITY_MATCH_ALL) -> None:
|
||||
await hass.services.async_call(siren.DOMAIN, SERVICE_TURN_OFF, data, blocking=True)
|
||||
|
||||
|
||||
async def test_controlling_state_via_topic(hass, mqtt_mock):
|
||||
async def test_controlling_state_via_topic(hass, mqtt_mock_entry_with_yaml_config):
|
||||
"""Test the controlling state via topic."""
|
||||
assert await async_setup_component(
|
||||
hass,
|
||||
@@ -87,6 +87,7 @@ async def test_controlling_state_via_topic(hass, mqtt_mock):
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
await mqtt_mock_entry_with_yaml_config()
|
||||
|
||||
state = hass.states.get("siren.test")
|
||||
assert state.state == STATE_UNKNOWN
|
||||
@@ -103,7 +104,9 @@ async def test_controlling_state_via_topic(hass, mqtt_mock):
|
||||
assert state.state == STATE_OFF
|
||||
|
||||
|
||||
async def test_sending_mqtt_commands_and_optimistic(hass, mqtt_mock):
|
||||
async def test_sending_mqtt_commands_and_optimistic(
|
||||
hass, mqtt_mock_entry_with_yaml_config
|
||||
):
|
||||
"""Test the sending MQTT commands in optimistic mode."""
|
||||
assert await async_setup_component(
|
||||
hass,
|
||||
@@ -120,6 +123,7 @@ async def test_sending_mqtt_commands_and_optimistic(hass, mqtt_mock):
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
mqtt_mock = await mqtt_mock_entry_with_yaml_config()
|
||||
|
||||
state = hass.states.get("siren.test")
|
||||
assert state.state == STATE_OFF
|
||||
@@ -143,7 +147,9 @@ async def test_sending_mqtt_commands_and_optimistic(hass, mqtt_mock):
|
||||
assert state.state == STATE_OFF
|
||||
|
||||
|
||||
async def test_controlling_state_via_topic_and_json_message(hass, mqtt_mock, caplog):
|
||||
async def test_controlling_state_via_topic_and_json_message(
|
||||
hass, mqtt_mock_entry_with_yaml_config, caplog
|
||||
):
|
||||
"""Test the controlling state via topic and JSON message."""
|
||||
assert await async_setup_component(
|
||||
hass,
|
||||
@@ -161,6 +167,7 @@ async def test_controlling_state_via_topic_and_json_message(hass, mqtt_mock, cap
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
await mqtt_mock_entry_with_yaml_config()
|
||||
|
||||
state = hass.states.get("siren.test")
|
||||
assert state.state == STATE_UNKNOWN
|
||||
@@ -181,7 +188,7 @@ async def test_controlling_state_via_topic_and_json_message(hass, mqtt_mock, cap
|
||||
|
||||
|
||||
async def test_controlling_state_and_attributes_with_json_message_without_template(
|
||||
hass, mqtt_mock, caplog
|
||||
hass, mqtt_mock_entry_with_yaml_config, caplog
|
||||
):
|
||||
"""Test the controlling state via topic and JSON message without a value template."""
|
||||
assert await async_setup_component(
|
||||
@@ -200,6 +207,7 @@ async def test_controlling_state_and_attributes_with_json_message_without_templa
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
await mqtt_mock_entry_with_yaml_config()
|
||||
|
||||
state = hass.states.get("siren.test")
|
||||
assert state.state == STATE_UNKNOWN
|
||||
@@ -262,7 +270,9 @@ async def test_controlling_state_and_attributes_with_json_message_without_templa
|
||||
)
|
||||
|
||||
|
||||
async def test_filtering_not_supported_attributes_optimistic(hass, mqtt_mock):
|
||||
async def test_filtering_not_supported_attributes_optimistic(
|
||||
hass, mqtt_mock_entry_with_yaml_config
|
||||
):
|
||||
"""Test setting attributes with support flags optimistic."""
|
||||
config = {
|
||||
"platform": "mqtt",
|
||||
@@ -285,6 +295,7 @@ async def test_filtering_not_supported_attributes_optimistic(hass, mqtt_mock):
|
||||
{siren.DOMAIN: [config1, config2, config3]},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
await mqtt_mock_entry_with_yaml_config()
|
||||
|
||||
state1 = hass.states.get("siren.test1")
|
||||
assert state1.state == STATE_OFF
|
||||
@@ -345,7 +356,9 @@ async def test_filtering_not_supported_attributes_optimistic(hass, mqtt_mock):
|
||||
assert state3.attributes.get(siren.ATTR_VOLUME_LEVEL) == 0.88
|
||||
|
||||
|
||||
async def test_filtering_not_supported_attributes_via_state(hass, mqtt_mock):
|
||||
async def test_filtering_not_supported_attributes_via_state(
|
||||
hass, mqtt_mock_entry_with_yaml_config
|
||||
):
|
||||
"""Test setting attributes with support flags via state."""
|
||||
config = {
|
||||
"platform": "mqtt",
|
||||
@@ -371,6 +384,7 @@ async def test_filtering_not_supported_attributes_via_state(hass, mqtt_mock):
|
||||
{siren.DOMAIN: [config1, config2, config3]},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
await mqtt_mock_entry_with_yaml_config()
|
||||
|
||||
state1 = hass.states.get("siren.test1")
|
||||
assert state1.state == STATE_UNKNOWN
|
||||
@@ -422,21 +436,23 @@ async def test_filtering_not_supported_attributes_via_state(hass, mqtt_mock):
|
||||
assert state3.attributes.get(siren.ATTR_VOLUME_LEVEL) == 0.88
|
||||
|
||||
|
||||
async def test_availability_when_connection_lost(hass, mqtt_mock):
|
||||
async def test_availability_when_connection_lost(
|
||||
hass, mqtt_mock_entry_with_yaml_config
|
||||
):
|
||||
"""Test availability after MQTT disconnection."""
|
||||
await help_test_availability_when_connection_lost(
|
||||
hass, mqtt_mock, siren.DOMAIN, DEFAULT_CONFIG
|
||||
hass, mqtt_mock_entry_with_yaml_config, siren.DOMAIN, DEFAULT_CONFIG
|
||||
)
|
||||
|
||||
|
||||
async def test_availability_without_topic(hass, mqtt_mock):
|
||||
async def test_availability_without_topic(hass, mqtt_mock_entry_with_yaml_config):
|
||||
"""Test availability without defined availability topic."""
|
||||
await help_test_availability_without_topic(
|
||||
hass, mqtt_mock, siren.DOMAIN, DEFAULT_CONFIG
|
||||
hass, mqtt_mock_entry_with_yaml_config, siren.DOMAIN, DEFAULT_CONFIG
|
||||
)
|
||||
|
||||
|
||||
async def test_default_availability_payload(hass, mqtt_mock):
|
||||
async def test_default_availability_payload(hass, mqtt_mock_entry_with_yaml_config):
|
||||
"""Test availability by default payload with defined topic."""
|
||||
config = {
|
||||
siren.DOMAIN: {
|
||||
@@ -450,11 +466,17 @@ async def test_default_availability_payload(hass, mqtt_mock):
|
||||
}
|
||||
|
||||
await help_test_default_availability_payload(
|
||||
hass, mqtt_mock, siren.DOMAIN, config, True, "state-topic", "1"
|
||||
hass,
|
||||
mqtt_mock_entry_with_yaml_config,
|
||||
siren.DOMAIN,
|
||||
config,
|
||||
True,
|
||||
"state-topic",
|
||||
"1",
|
||||
)
|
||||
|
||||
|
||||
async def test_custom_availability_payload(hass, mqtt_mock):
|
||||
async def test_custom_availability_payload(hass, mqtt_mock_entry_with_yaml_config):
|
||||
"""Test availability by custom payload with defined topic."""
|
||||
config = {
|
||||
siren.DOMAIN: {
|
||||
@@ -468,11 +490,17 @@ async def test_custom_availability_payload(hass, mqtt_mock):
|
||||
}
|
||||
|
||||
await help_test_custom_availability_payload(
|
||||
hass, mqtt_mock, siren.DOMAIN, config, True, "state-topic", "1"
|
||||
hass,
|
||||
mqtt_mock_entry_with_yaml_config,
|
||||
siren.DOMAIN,
|
||||
config,
|
||||
True,
|
||||
"state-topic",
|
||||
"1",
|
||||
)
|
||||
|
||||
|
||||
async def test_custom_state_payload(hass, mqtt_mock):
|
||||
async def test_custom_state_payload(hass, mqtt_mock_entry_with_yaml_config):
|
||||
"""Test the state payload."""
|
||||
assert await async_setup_component(
|
||||
hass,
|
||||
@@ -491,6 +519,7 @@ async def test_custom_state_payload(hass, mqtt_mock):
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
await mqtt_mock_entry_with_yaml_config()
|
||||
|
||||
state = hass.states.get("siren.test")
|
||||
assert state.state == STATE_UNKNOWN
|
||||
@@ -507,49 +536,57 @@ async def test_custom_state_payload(hass, mqtt_mock):
|
||||
assert state.state == STATE_OFF
|
||||
|
||||
|
||||
async def test_setting_attribute_via_mqtt_json_message(hass, mqtt_mock):
|
||||
async def test_setting_attribute_via_mqtt_json_message(
|
||||
hass, mqtt_mock_entry_with_yaml_config
|
||||
):
|
||||
"""Test the setting of attribute via MQTT with JSON payload."""
|
||||
await help_test_setting_attribute_via_mqtt_json_message(
|
||||
hass, mqtt_mock, siren.DOMAIN, DEFAULT_CONFIG
|
||||
hass, mqtt_mock_entry_with_yaml_config, siren.DOMAIN, DEFAULT_CONFIG
|
||||
)
|
||||
|
||||
|
||||
async def test_setting_blocked_attribute_via_mqtt_json_message(hass, mqtt_mock):
|
||||
async def test_setting_blocked_attribute_via_mqtt_json_message(
|
||||
hass, mqtt_mock_entry_no_yaml_config
|
||||
):
|
||||
"""Test the setting of attribute via MQTT with JSON payload."""
|
||||
await help_test_setting_blocked_attribute_via_mqtt_json_message(
|
||||
hass, mqtt_mock, siren.DOMAIN, DEFAULT_CONFIG, {}
|
||||
hass, mqtt_mock_entry_no_yaml_config, siren.DOMAIN, DEFAULT_CONFIG, {}
|
||||
)
|
||||
|
||||
|
||||
async def test_setting_attribute_with_template(hass, mqtt_mock):
|
||||
async def test_setting_attribute_with_template(hass, mqtt_mock_entry_with_yaml_config):
|
||||
"""Test the setting of attribute via MQTT with JSON payload."""
|
||||
await help_test_setting_attribute_with_template(
|
||||
hass, mqtt_mock, siren.DOMAIN, DEFAULT_CONFIG
|
||||
hass, mqtt_mock_entry_with_yaml_config, siren.DOMAIN, DEFAULT_CONFIG
|
||||
)
|
||||
|
||||
|
||||
async def test_update_with_json_attrs_not_dict(hass, mqtt_mock, caplog):
|
||||
async def test_update_with_json_attrs_not_dict(
|
||||
hass, mqtt_mock_entry_with_yaml_config, caplog
|
||||
):
|
||||
"""Test attributes get extracted from a JSON result."""
|
||||
await help_test_update_with_json_attrs_not_dict(
|
||||
hass, mqtt_mock, caplog, siren.DOMAIN, DEFAULT_CONFIG
|
||||
hass, mqtt_mock_entry_with_yaml_config, caplog, siren.DOMAIN, DEFAULT_CONFIG
|
||||
)
|
||||
|
||||
|
||||
async def test_update_with_json_attrs_bad_JSON(hass, mqtt_mock, caplog):
|
||||
async def test_update_with_json_attrs_bad_JSON(
|
||||
hass, mqtt_mock_entry_with_yaml_config, caplog
|
||||
):
|
||||
"""Test attributes get extracted from a JSON result."""
|
||||
await help_test_update_with_json_attrs_bad_JSON(
|
||||
hass, mqtt_mock, caplog, siren.DOMAIN, DEFAULT_CONFIG
|
||||
hass, mqtt_mock_entry_with_yaml_config, caplog, siren.DOMAIN, DEFAULT_CONFIG
|
||||
)
|
||||
|
||||
|
||||
async def test_discovery_update_attr(hass, mqtt_mock, caplog):
|
||||
async def test_discovery_update_attr(hass, mqtt_mock_entry_no_yaml_config, caplog):
|
||||
"""Test update of discovered MQTTAttributes."""
|
||||
await help_test_discovery_update_attr(
|
||||
hass, mqtt_mock, caplog, siren.DOMAIN, DEFAULT_CONFIG
|
||||
hass, mqtt_mock_entry_no_yaml_config, caplog, siren.DOMAIN, DEFAULT_CONFIG
|
||||
)
|
||||
|
||||
|
||||
async def test_unique_id(hass, mqtt_mock):
|
||||
async def test_unique_id(hass, mqtt_mock_entry_with_yaml_config):
|
||||
"""Test unique id option only creates one siren per unique_id."""
|
||||
config = {
|
||||
siren.DOMAIN: [
|
||||
@@ -569,20 +606,26 @@ async def test_unique_id(hass, mqtt_mock):
|
||||
},
|
||||
]
|
||||
}
|
||||
await help_test_unique_id(hass, mqtt_mock, siren.DOMAIN, config)
|
||||
await help_test_unique_id(
|
||||
hass, mqtt_mock_entry_with_yaml_config, siren.DOMAIN, config
|
||||
)
|
||||
|
||||
|
||||
async def test_discovery_removal_siren(hass, mqtt_mock, caplog):
|
||||
async def test_discovery_removal_siren(hass, mqtt_mock_entry_no_yaml_config, caplog):
|
||||
"""Test removal of discovered siren."""
|
||||
data = (
|
||||
'{ "name": "test",'
|
||||
' "state_topic": "test_topic",'
|
||||
' "command_topic": "test_topic" }'
|
||||
)
|
||||
await help_test_discovery_removal(hass, mqtt_mock, caplog, siren.DOMAIN, data)
|
||||
await help_test_discovery_removal(
|
||||
hass, mqtt_mock_entry_no_yaml_config, caplog, siren.DOMAIN, data
|
||||
)
|
||||
|
||||
|
||||
async def test_discovery_update_siren_topic_template(hass, mqtt_mock, caplog):
|
||||
async def test_discovery_update_siren_topic_template(
|
||||
hass, mqtt_mock_entry_no_yaml_config, caplog
|
||||
):
|
||||
"""Test update of discovered siren."""
|
||||
config1 = copy.deepcopy(DEFAULT_CONFIG[siren.DOMAIN])
|
||||
config2 = copy.deepcopy(DEFAULT_CONFIG[siren.DOMAIN])
|
||||
@@ -607,7 +650,7 @@ async def test_discovery_update_siren_topic_template(hass, mqtt_mock, caplog):
|
||||
|
||||
await help_test_discovery_update(
|
||||
hass,
|
||||
mqtt_mock,
|
||||
mqtt_mock_entry_no_yaml_config,
|
||||
caplog,
|
||||
siren.DOMAIN,
|
||||
config1,
|
||||
@@ -617,7 +660,9 @@ async def test_discovery_update_siren_topic_template(hass, mqtt_mock, caplog):
|
||||
)
|
||||
|
||||
|
||||
async def test_discovery_update_siren_template(hass, mqtt_mock, caplog):
|
||||
async def test_discovery_update_siren_template(
|
||||
hass, mqtt_mock_entry_no_yaml_config, caplog
|
||||
):
|
||||
"""Test update of discovered siren."""
|
||||
config1 = copy.deepcopy(DEFAULT_CONFIG[siren.DOMAIN])
|
||||
config2 = copy.deepcopy(DEFAULT_CONFIG[siren.DOMAIN])
|
||||
@@ -640,7 +685,7 @@ async def test_discovery_update_siren_template(hass, mqtt_mock, caplog):
|
||||
|
||||
await help_test_discovery_update(
|
||||
hass,
|
||||
mqtt_mock,
|
||||
mqtt_mock_entry_no_yaml_config,
|
||||
caplog,
|
||||
siren.DOMAIN,
|
||||
config1,
|
||||
@@ -650,7 +695,7 @@ async def test_discovery_update_siren_template(hass, mqtt_mock, caplog):
|
||||
)
|
||||
|
||||
|
||||
async def test_command_templates(hass, mqtt_mock, caplog):
|
||||
async def test_command_templates(hass, mqtt_mock_entry_with_yaml_config, caplog):
|
||||
"""Test siren with command templates optimistic."""
|
||||
config1 = copy.deepcopy(DEFAULT_CONFIG[siren.DOMAIN])
|
||||
config1["name"] = "Beer"
|
||||
@@ -669,6 +714,7 @@ async def test_command_templates(hass, mqtt_mock, caplog):
|
||||
{siren.DOMAIN: [config1, config2]},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
mqtt_mock = await mqtt_mock_entry_with_yaml_config()
|
||||
|
||||
state1 = hass.states.get("siren.beer")
|
||||
assert state1.state == STATE_OFF
|
||||
@@ -729,7 +775,9 @@ async def test_command_templates(hass, mqtt_mock, caplog):
|
||||
mqtt_mock.reset_mock()
|
||||
|
||||
|
||||
async def test_discovery_update_unchanged_siren(hass, mqtt_mock, caplog):
|
||||
async def test_discovery_update_unchanged_siren(
|
||||
hass, mqtt_mock_entry_no_yaml_config, caplog
|
||||
):
|
||||
"""Test update of discovered siren."""
|
||||
data1 = (
|
||||
'{ "name": "Beer",'
|
||||
@@ -741,12 +789,17 @@ async def test_discovery_update_unchanged_siren(hass, mqtt_mock, caplog):
|
||||
"homeassistant.components.mqtt.siren.MqttSiren.discovery_update"
|
||||
) as discovery_update:
|
||||
await help_test_discovery_update_unchanged(
|
||||
hass, mqtt_mock, caplog, siren.DOMAIN, data1, discovery_update
|
||||
hass,
|
||||
mqtt_mock_entry_no_yaml_config,
|
||||
caplog,
|
||||
siren.DOMAIN,
|
||||
data1,
|
||||
discovery_update,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.no_fail_on_log_exception
|
||||
async def test_discovery_broken(hass, mqtt_mock, caplog):
|
||||
async def test_discovery_broken(hass, mqtt_mock_entry_no_yaml_config, caplog):
|
||||
"""Test handling of bad discovery message."""
|
||||
data1 = '{ "name": "Beer" }'
|
||||
data2 = (
|
||||
@@ -755,57 +808,57 @@ async def test_discovery_broken(hass, mqtt_mock, caplog):
|
||||
' "command_topic": "test_topic" }'
|
||||
)
|
||||
await help_test_discovery_broken(
|
||||
hass, mqtt_mock, caplog, siren.DOMAIN, data1, data2
|
||||
hass, mqtt_mock_entry_no_yaml_config, caplog, siren.DOMAIN, data1, data2
|
||||
)
|
||||
|
||||
|
||||
async def test_entity_device_info_with_connection(hass, mqtt_mock):
|
||||
async def test_entity_device_info_with_connection(hass, mqtt_mock_entry_no_yaml_config):
|
||||
"""Test MQTT siren device registry integration."""
|
||||
await help_test_entity_device_info_with_connection(
|
||||
hass, mqtt_mock, siren.DOMAIN, DEFAULT_CONFIG
|
||||
hass, mqtt_mock_entry_no_yaml_config, siren.DOMAIN, DEFAULT_CONFIG
|
||||
)
|
||||
|
||||
|
||||
async def test_entity_device_info_with_identifier(hass, mqtt_mock):
|
||||
async def test_entity_device_info_with_identifier(hass, mqtt_mock_entry_no_yaml_config):
|
||||
"""Test MQTT siren device registry integration."""
|
||||
await help_test_entity_device_info_with_identifier(
|
||||
hass, mqtt_mock, siren.DOMAIN, DEFAULT_CONFIG
|
||||
hass, mqtt_mock_entry_no_yaml_config, siren.DOMAIN, DEFAULT_CONFIG
|
||||
)
|
||||
|
||||
|
||||
async def test_entity_device_info_update(hass, mqtt_mock):
|
||||
async def test_entity_device_info_update(hass, mqtt_mock_entry_no_yaml_config):
|
||||
"""Test device registry update."""
|
||||
await help_test_entity_device_info_update(
|
||||
hass, mqtt_mock, siren.DOMAIN, DEFAULT_CONFIG
|
||||
hass, mqtt_mock_entry_no_yaml_config, siren.DOMAIN, DEFAULT_CONFIG
|
||||
)
|
||||
|
||||
|
||||
async def test_entity_device_info_remove(hass, mqtt_mock):
|
||||
async def test_entity_device_info_remove(hass, mqtt_mock_entry_no_yaml_config):
|
||||
"""Test device registry remove."""
|
||||
await help_test_entity_device_info_remove(
|
||||
hass, mqtt_mock, siren.DOMAIN, DEFAULT_CONFIG
|
||||
hass, mqtt_mock_entry_no_yaml_config, siren.DOMAIN, DEFAULT_CONFIG
|
||||
)
|
||||
|
||||
|
||||
async def test_entity_id_update_subscriptions(hass, mqtt_mock):
|
||||
async def test_entity_id_update_subscriptions(hass, mqtt_mock_entry_with_yaml_config):
|
||||
"""Test MQTT subscriptions are managed when entity_id is updated."""
|
||||
await help_test_entity_id_update_subscriptions(
|
||||
hass, mqtt_mock, siren.DOMAIN, DEFAULT_CONFIG
|
||||
hass, mqtt_mock_entry_with_yaml_config, siren.DOMAIN, DEFAULT_CONFIG
|
||||
)
|
||||
|
||||
|
||||
async def test_entity_id_update_discovery_update(hass, mqtt_mock):
|
||||
async def test_entity_id_update_discovery_update(hass, mqtt_mock_entry_no_yaml_config):
|
||||
"""Test MQTT discovery update when entity_id is updated."""
|
||||
await help_test_entity_id_update_discovery_update(
|
||||
hass, mqtt_mock, siren.DOMAIN, DEFAULT_CONFIG
|
||||
hass, mqtt_mock_entry_no_yaml_config, siren.DOMAIN, DEFAULT_CONFIG
|
||||
)
|
||||
|
||||
|
||||
async def test_entity_debug_info_message(hass, mqtt_mock):
|
||||
async def test_entity_debug_info_message(hass, mqtt_mock_entry_no_yaml_config):
|
||||
"""Test MQTT debug info."""
|
||||
await help_test_entity_debug_info_message(
|
||||
hass,
|
||||
mqtt_mock,
|
||||
mqtt_mock_entry_no_yaml_config,
|
||||
siren.DOMAIN,
|
||||
DEFAULT_CONFIG,
|
||||
siren.SERVICE_TURN_ON,
|
||||
@@ -834,7 +887,7 @@ async def test_entity_debug_info_message(hass, mqtt_mock):
|
||||
)
|
||||
async def test_publishing_with_custom_encoding(
|
||||
hass,
|
||||
mqtt_mock,
|
||||
mqtt_mock_entry_with_yaml_config,
|
||||
caplog,
|
||||
service,
|
||||
topic,
|
||||
@@ -849,7 +902,7 @@ async def test_publishing_with_custom_encoding(
|
||||
|
||||
await help_test_publishing_with_custom_encoding(
|
||||
hass,
|
||||
mqtt_mock,
|
||||
mqtt_mock_entry_with_yaml_config,
|
||||
caplog,
|
||||
domain,
|
||||
config,
|
||||
@@ -861,11 +914,13 @@ async def test_publishing_with_custom_encoding(
|
||||
)
|
||||
|
||||
|
||||
async def test_reloadable(hass, mqtt_mock, caplog, tmp_path):
|
||||
async def test_reloadable(hass, mqtt_mock_entry_with_yaml_config, caplog, tmp_path):
|
||||
"""Test reloading the MQTT platform."""
|
||||
domain = siren.DOMAIN
|
||||
config = DEFAULT_CONFIG[domain]
|
||||
await help_test_reloadable(hass, mqtt_mock, caplog, tmp_path, domain, config)
|
||||
await help_test_reloadable(
|
||||
hass, mqtt_mock_entry_with_yaml_config, caplog, tmp_path, domain, config
|
||||
)
|
||||
|
||||
|
||||
async def test_reloadable_late(hass, mqtt_client_mock, caplog, tmp_path):
|
||||
@@ -882,12 +937,18 @@ async def test_reloadable_late(hass, mqtt_client_mock, caplog, tmp_path):
|
||||
],
|
||||
)
|
||||
async def test_encoding_subscribable_topics(
|
||||
hass, mqtt_mock, caplog, topic, value, attribute, attribute_value
|
||||
hass,
|
||||
mqtt_mock_entry_with_yaml_config,
|
||||
caplog,
|
||||
topic,
|
||||
value,
|
||||
attribute,
|
||||
attribute_value,
|
||||
):
|
||||
"""Test handling of incoming encoded payload."""
|
||||
await help_test_encoding_subscribable_topics(
|
||||
hass,
|
||||
mqtt_mock,
|
||||
mqtt_mock_entry_with_yaml_config,
|
||||
caplog,
|
||||
siren.DOMAIN,
|
||||
DEFAULT_CONFIG[siren.DOMAIN],
|
||||
|
Reference in New Issue
Block a user