Improve MQTT test coverage and remove dead code (#33584)
* Improve MQTT tests and remove dead code * Remove useless test. * Add more test
This commit is contained in:
1 parent
a813847f6e
commit
4e6fd19624
12 files changed
+761
-125
No files matched your search
@@ -534,6 +534,22 @@ async def test_set_hold(hass, mqtt_mock):
|
||||
assert state.attributes.get("preset_mode") is None
|
||||
|
||||
|
||||
async def test_set_preset_mode_twice(hass, mqtt_mock):
|
||||
"""Test setting of the same mode twice only publishes once."""
|
||||
assert await async_setup_component(hass, CLIMATE_DOMAIN, DEFAULT_CONFIG)
|
||||
|
||||
state = hass.states.get(ENTITY_CLIMATE)
|
||||
assert state.attributes.get("preset_mode") is None
|
||||
await common.async_set_preset_mode(hass, "hold-on", ENTITY_CLIMATE)
|
||||
mqtt_mock.async_publish.assert_called_once_with("hold-topic", "hold-on", 0, False)
|
||||
mqtt_mock.async_publish.reset_mock()
|
||||
state = hass.states.get(ENTITY_CLIMATE)
|
||||
assert state.attributes.get("preset_mode") == "hold-on"
|
||||
|
||||
await common.async_set_preset_mode(hass, "hold-on", ENTITY_CLIMATE)
|
||||
mqtt_mock.async_publish.assert_not_called()
|
||||
|
||||
|
||||
async def test_set_aux_pessimistic(hass, mqtt_mock):
|
||||
"""Test setting of the aux heating in pessimistic mode."""
|
||||
config = copy.deepcopy(DEFAULT_CONFIG)
|
||||
|
||||
Reference in new issue
Block a user