예제 #1
0
 def test_set_operation(self):
     """Test setting of new operation mode."""
     state = self.hass.states.get(ENTITY_WATER_HEATER)
     assert "eco" == state.attributes.get("operation_mode")
     assert "eco" == state.state
     common.set_operation_mode(self.hass, "electric", ENTITY_WATER_HEATER)
     self.hass.block_till_done()
     state = self.hass.states.get(ENTITY_WATER_HEATER)
     assert "electric" == state.attributes.get("operation_mode")
     assert "electric" == state.state
예제 #2
0
 def test_set_operation(self):
     """Test setting of new operation mode."""
     state = self.hass.states.get(ENTITY_WATER_HEATER)
     assert "eco" == state.attributes.get('operation_mode')
     assert "eco" == state.state
     common.set_operation_mode(self.hass, "electric", ENTITY_WATER_HEATER)
     self.hass.block_till_done()
     state = self.hass.states.get(ENTITY_WATER_HEATER)
     assert "electric" == state.attributes.get('operation_mode')
     assert "electric" == state.state
예제 #3
0
 def test_set_operation(self):
     """Test setting of new operation mode."""
     state = self.hass.states.get(ENTITY_WATER_HEATER)
     self.assertEqual("eco", state.attributes.get('operation_mode'))
     self.assertEqual("eco", state.state)
     common.set_operation_mode(self.hass, "electric", ENTITY_WATER_HEATER)
     self.hass.block_till_done()
     state = self.hass.states.get(ENTITY_WATER_HEATER)
     self.assertEqual("electric", state.attributes.get('operation_mode'))
     self.assertEqual("electric", state.state)
예제 #4
0
    def test_set_operation_bad_attr_and_state(self):
        """Test setting operation mode without required attribute.

        Also check the state.
        """
        state = self.hass.states.get(ENTITY_WATER_HEATER)
        assert "eco" == state.attributes.get('operation_mode')
        assert "eco" == state.state
        common.set_operation_mode(self.hass, None, ENTITY_WATER_HEATER)
        self.hass.block_till_done()
        state = self.hass.states.get(ENTITY_WATER_HEATER)
        assert "eco" == state.attributes.get('operation_mode')
        assert "eco" == state.state
예제 #5
0
    def test_set_operation_bad_attr_and_state(self):
        """Test setting operation mode without required attribute.

        Also check the state.
        """
        state = self.hass.states.get(ENTITY_WATER_HEATER)
        assert "eco" == state.attributes.get('operation_mode')
        assert "eco" == state.state
        with pytest.raises(vol.Invalid):
            common.set_operation_mode(self.hass, None, ENTITY_WATER_HEATER)
        self.hass.block_till_done()
        state = self.hass.states.get(ENTITY_WATER_HEATER)
        assert "eco" == state.attributes.get('operation_mode')
        assert "eco" == state.state
예제 #6
0
    def test_set_operation_bad_attr_and_state(self):
        """Test setting operation mode without required attribute.

        Also check the state.
        """
        state = self.opp.states.get(ENTITY_WATER_HEATER)
        assert "eco" == state.attributes.get("operation_mode")
        assert "eco" == state.state
        with pytest.raises(vol.Invalid):
            common.set_operation_mode(self.opp, None, ENTITY_WATER_HEATER)
        self.opp.block_till_done()
        state = self.opp.states.get(ENTITY_WATER_HEATER)
        assert "eco" == state.attributes.get("operation_mode")
        assert "eco" == state.state