Switch mqtt to use json helper (#73871)

* Switch mqtt to use json helper

* whitespace
This commit is contained in:
J. Nick Koston
2022-06-23 07:29:09 -05:00
committed by GitHub
parent 95eeb8eff3
commit 2742bf86e3
10 changed files with 34 additions and 36 deletions

View File

@ -688,7 +688,7 @@ async def test_sending_mqtt_commands_and_optimistic(
await common.async_turn_on(hass, "light.test")
mqtt_mock.async_publish.assert_called_once_with(
"test_light_rgb/set", '{"state": "ON"}', 2, False
"test_light_rgb/set", '{"state":"ON"}', 2, False
)
mqtt_mock.async_publish.reset_mock()
state = hass.states.get("light.test")
@ -709,7 +709,7 @@ async def test_sending_mqtt_commands_and_optimistic(
await common.async_turn_off(hass, "light.test")
mqtt_mock.async_publish.assert_called_once_with(
"test_light_rgb/set", '{"state": "OFF"}', 2, False
"test_light_rgb/set", '{"state":"OFF"}', 2, False
)
mqtt_mock.async_publish.reset_mock()
state = hass.states.get("light.test")
@ -838,7 +838,7 @@ async def test_sending_mqtt_commands_and_optimistic2(
# Turn the light on
await common.async_turn_on(hass, "light.test")
mqtt_mock.async_publish.assert_called_once_with(
"test_light_rgb/set", '{"state": "ON"}', 2, False
"test_light_rgb/set", '{"state":"ON"}', 2, False
)
mqtt_mock.async_publish.reset_mock()
state = hass.states.get("light.test")
@ -848,7 +848,7 @@ async def test_sending_mqtt_commands_and_optimistic2(
await common.async_turn_on(hass, "light.test", color_temp=90)
mqtt_mock.async_publish.assert_called_once_with(
"test_light_rgb/set",
JsonValidator('{"state": "ON", "color_temp": 90}'),
JsonValidator('{"state":"ON","color_temp":90}'),
2,
False,
)
@ -859,7 +859,7 @@ async def test_sending_mqtt_commands_and_optimistic2(
# Turn the light off
await common.async_turn_off(hass, "light.test")
mqtt_mock.async_publish.assert_called_once_with(
"test_light_rgb/set", '{"state": "OFF"}', 2, False
"test_light_rgb/set", '{"state":"OFF"}', 2, False
)
mqtt_mock.async_publish.reset_mock()
state = hass.states.get("light.test")
@ -2004,7 +2004,7 @@ async def test_entity_debug_info_message(hass, mqtt_mock_entry_no_yaml_config):
light.DOMAIN,
DEFAULT_CONFIG,
light.SERVICE_TURN_ON,
command_payload='{"state": "ON"}',
command_payload='{"state":"ON"}',
state_payload='{"state":"ON"}',
)
@ -2038,7 +2038,7 @@ async def test_max_mireds(hass, mqtt_mock_entry_with_yaml_config):
light.SERVICE_TURN_ON,
"command_topic",
None,
'{"state": "ON"}',
'{"state":"ON"}',
None,
None,
None,
@ -2047,7 +2047,7 @@ async def test_max_mireds(hass, mqtt_mock_entry_with_yaml_config):
light.SERVICE_TURN_OFF,
"command_topic",
None,
'{"state": "OFF"}',
'{"state":"OFF"}',
None,
None,
None,