def test_set_swing_mode_bad_attr(self): """Test setting swing mode without required attribute.""" state = self.hass.states.get(ENTITY_HVAC) self.assertEqual("Off", state.attributes.get('swing_mode')) hvac.set_swing_mode(self.hass, None, ENTITY_HVAC) self.hass.pool.block_till_done() self.assertEqual("Off", state.attributes.get('swing_mode'))
def test_set_swing(self): """Test setting of new swing mode.""" hvac.set_swing_mode(self.hass, "Auto", ENTITY_HVAC) self.hass.pool.block_till_done() state = self.hass.states.get(ENTITY_HVAC) self.assertEqual("Auto", state.attributes.get('swing_mode'))