mirror of
https://github.com/home-assistant/core.git
synced 2025-11-05 08:59:57 +00:00
Mqtt fix issue with displaying non UTF-8 payload (#67471)
* Mqtt fix issue with displaying non UTF-8 payload * None or binary * Casting and additional test * casting
This commit is contained in:
@@ -1647,6 +1647,7 @@ async def test_mqtt_ws_subscription(hass, hass_ws_client, mqtt_mock):
|
||||
|
||||
async_fire_mqtt_message(hass, "test-topic", "test1")
|
||||
async_fire_mqtt_message(hass, "test-topic", "test2")
|
||||
async_fire_mqtt_message(hass, "test-topic", b"\xDE\xAD\xBE\xEF")
|
||||
|
||||
response = await client.receive_json()
|
||||
assert response["event"]["topic"] == "test-topic"
|
||||
@@ -1656,6 +1657,10 @@ async def test_mqtt_ws_subscription(hass, hass_ws_client, mqtt_mock):
|
||||
assert response["event"]["topic"] == "test-topic"
|
||||
assert response["event"]["payload"] == "test2"
|
||||
|
||||
response = await client.receive_json()
|
||||
assert response["event"]["topic"] == "test-topic"
|
||||
assert response["event"]["payload"] == "b'\\xde\\xad\\xbe\\xef'"
|
||||
|
||||
# Unsubscribe
|
||||
await client.send_json({"id": 8, "type": "unsubscribe_events", "subscription": 5})
|
||||
response = await client.receive_json()
|
||||
|
||||
Reference in New Issue
Block a user