mirror of
https://github.com/home-assistant/core.git
synced 2025-07-29 18:28:14 +02:00
Allow to omit the payload attribute to MQTT publish action to allow an empty payload to be sent by default (#137595)
Allow to omit the payload attribute to MQTT publish actionto allow an empty payload to be sent by default
This commit is contained in:
@ -391,6 +391,25 @@ async def test_service_call_with_ascii_qos_retain_flags(
|
||||
blocking=True,
|
||||
)
|
||||
assert mqtt_mock.async_publish.called
|
||||
assert mqtt_mock.async_publish.call_args[0][1] == ""
|
||||
assert mqtt_mock.async_publish.call_args[0][2] == 2
|
||||
assert not mqtt_mock.async_publish.call_args[0][3]
|
||||
|
||||
mqtt_mock.reset_mock()
|
||||
|
||||
# Test service call without payload
|
||||
await hass.services.async_call(
|
||||
mqtt.DOMAIN,
|
||||
mqtt.SERVICE_PUBLISH,
|
||||
{
|
||||
mqtt.ATTR_TOPIC: "test/topic",
|
||||
mqtt.ATTR_QOS: "2",
|
||||
mqtt.ATTR_RETAIN: "no",
|
||||
},
|
||||
blocking=True,
|
||||
)
|
||||
assert mqtt_mock.async_publish.called
|
||||
assert mqtt_mock.async_publish.call_args[0][1] is None
|
||||
assert mqtt_mock.async_publish.call_args[0][2] == 2
|
||||
assert not mqtt_mock.async_publish.call_args[0][3]
|
||||
|
||||
|
Reference in New Issue
Block a user