Pass Message object to MQTT message callbacks (#21959)
* Pass Message object to MQTT message callbacks * Improve method of detecting deprecated msg callback * Fix mysensors * Fixup * Review comments * Fix merge error
This commit is contained in:
1 parent
50ec3d7de5
commit
5957e4b75b
19 files changed
+203
-142
No files matched your search
@@ -35,8 +35,8 @@ async def test_subscribe_topics(hass, mqtt_mock, caplog):
|
||||
async_fire_mqtt_message(hass, 'test-topic1', 'test-payload1')
|
||||
await hass.async_block_till_done()
|
||||
assert 1 == len(calls1)
|
||||
assert 'test-topic1' == calls1[0][0]
|
||||
assert 'test-payload1' == calls1[0][1]
|
||||
assert 'test-topic1' == calls1[0][0].topic
|
||||
assert 'test-payload1' == calls1[0][0].payload
|
||||
assert 0 == len(calls2)
|
||||
|
||||
async_fire_mqtt_message(hass, 'test-topic2', 'test-payload2')
|
||||
@@ -44,8 +44,8 @@ async def test_subscribe_topics(hass, mqtt_mock, caplog):
|
||||
await hass.async_block_till_done()
|
||||
assert 1 == len(calls1)
|
||||
assert 1 == len(calls2)
|
||||
assert 'test-topic2' == calls2[0][0]
|
||||
assert 'test-payload2' == calls2[0][1]
|
||||
assert 'test-topic2' == calls2[0][0].topic
|
||||
assert 'test-payload2' == calls2[0][0].payload
|
||||
|
||||
await async_unsubscribe_topics(hass, sub_state)
|
||||
|
||||
@@ -108,8 +108,8 @@ async def test_modify_topics(hass, mqtt_mock, caplog):
|
||||
await hass.async_block_till_done()
|
||||
await hass.async_block_till_done()
|
||||
assert 2 == len(calls1)
|
||||
assert 'test-topic1_1' == calls1[1][0]
|
||||
assert 'test-payload' == calls1[1][1]
|
||||
assert 'test-topic1_1' == calls1[1][0].topic
|
||||
assert 'test-payload' == calls1[1][0].payload
|
||||
assert 1 == len(calls2)
|
||||
|
||||
await async_unsubscribe_topics(hass, sub_state)
|
||||
|
||||
Reference in new issue
Block a user