async def test_hass_mode_to_melissa(hass): """Test for hass operations to melssa.""" with patch("homeassistant.components.melissa.climate._LOGGER.warning" ) as mocked_warning, patch("homeassistant.components.melissa"): api = melissa_mock() device = (await api.async_fetch_devices())[_SERIAL] thermostat = MelissaClimate(api, _SERIAL, device) assert thermostat.hass_mode_to_melissa(HVAC_MODE_FAN_ONLY) == 1 assert thermostat.hass_mode_to_melissa(HVAC_MODE_HEAT) == 2 assert thermostat.hass_mode_to_melissa(HVAC_MODE_COOL) == 3 assert thermostat.hass_mode_to_melissa(HVAC_MODE_DRY) == 4 thermostat.hass_mode_to_melissa("test") mocked_warning.assert_called_once_with( "Melissa have no setting for %s mode", "test")
async def test_hass_mode_to_melissa(hass): """Test for hass operations to melssa.""" with patch('homeassistant.components.melissa.climate._LOGGER.warning' ) as mocked_warning: with patch('homeassistant.components.melissa'): api = melissa_mock() device = (await api.async_fetch_devices())[_SERIAL] thermostat = MelissaClimate(api, _SERIAL, device) assert 1 == thermostat.hass_mode_to_melissa(STATE_FAN_ONLY) assert 2 == thermostat.hass_mode_to_melissa(STATE_HEAT) assert 3 == thermostat.hass_mode_to_melissa(STATE_COOL) assert 4 == thermostat.hass_mode_to_melissa(STATE_DRY) thermostat.hass_mode_to_melissa("test") mocked_warning.assert_called_once_with( "Melissa have no setting for %s mode", "test")