コード例 #1
0
    def test_is_on(self):
        """Test is on service call."""
        self.assertFalse(fan.is_on(self.hass, FAN_ENTITY_ID))

        fan.turn_on(self.hass, FAN_ENTITY_ID)
        self.hass.block_till_done()
        self.assertTrue(fan.is_on(self.hass, FAN_ENTITY_ID))
コード例 #2
0
ファイル: test_demo.py プロジェクト: MicSimoen/home-assistant
    def test_is_on(self):
        """Test is on service call."""
        self.assertFalse(fan.is_on(self.hass, FAN_ENTITY_ID))

        fan.turn_on(self.hass, FAN_ENTITY_ID)
        self.hass.pool.block_till_done()
        self.assertTrue(fan.is_on(self.hass, FAN_ENTITY_ID))
コード例 #3
0
    def test_turn_off(self):
        """Test turning off the device."""
        self.assertEqual(STATE_OFF, self.get_entity().state)

        fan.turn_on(self.hass, FAN_ENTITY_ID)
        self.hass.block_till_done()
        self.assertNotEqual(STATE_OFF, self.get_entity().state)

        fan.turn_off(self.hass, FAN_ENTITY_ID)
        self.hass.block_till_done()
        self.assertEqual(STATE_OFF, self.get_entity().state)
コード例 #4
0
ファイル: test_demo.py プロジェクト: MicSimoen/home-assistant
    def test_turn_off(self):
        """Test turning off the device."""
        self.assertEqual(STATE_OFF, self.get_entity().state)

        fan.turn_on(self.hass, FAN_ENTITY_ID)
        self.hass.pool.block_till_done()
        self.assertNotEqual(STATE_OFF, self.get_entity().state)

        fan.turn_off(self.hass, FAN_ENTITY_ID)
        self.hass.pool.block_till_done()
        self.assertEqual(STATE_OFF, self.get_entity().state)
コード例 #5
0
    def test_turn_off_without_entity_id(self):
        """Test turning off all fans."""
        self.assertEqual(STATE_OFF, self.get_entity().state)

        fan.turn_on(self.hass, FAN_ENTITY_ID)
        self.hass.block_till_done()
        self.assertNotEqual(STATE_OFF, self.get_entity().state)

        fan.turn_off(self.hass)
        self.hass.block_till_done()
        self.assertEqual(STATE_OFF, self.get_entity().state)
コード例 #6
0
    def test_turn_off_without_entity_id(self):
        """Test turning off all fans."""
        self.assertEqual(STATE_OFF, self.get_entity().state)

        fan.turn_on(self.hass, FAN_ENTITY_ID)
        self.hass.block_till_done()
        self.assertNotEqual(STATE_OFF, self.get_entity().state)

        fan.turn_off(self.hass)
        self.hass.block_till_done()
        self.assertEqual(STATE_OFF, self.get_entity().state)
コード例 #7
0
    def test_turn_on(self):
        """Test turning on the device."""
        self.assertEqual(STATE_OFF, self.get_entity().state)

        fan.turn_on(self.hass, FAN_ENTITY_ID)
        self.hass.block_till_done()
        self.assertNotEqual(STATE_OFF, self.get_entity().state)

        fan.turn_on(self.hass, FAN_ENTITY_ID, fan.SPEED_HIGH)
        self.hass.block_till_done()
        self.assertEqual(STATE_ON, self.get_entity().state)
        self.assertEqual(fan.SPEED_HIGH,
                         self.get_entity().attributes[fan.ATTR_SPEED])
コード例 #8
0
ファイル: test_demo.py プロジェクト: MicSimoen/home-assistant
    def test_turn_on(self):
        """Test turning on the device."""
        self.assertEqual(STATE_OFF, self.get_entity().state)

        fan.turn_on(self.hass, FAN_ENTITY_ID)
        self.hass.pool.block_till_done()
        self.assertNotEqual(STATE_OFF, self.get_entity().state)

        fan.turn_on(self.hass, FAN_ENTITY_ID, fan.SPEED_HIGH)
        self.hass.pool.block_till_done()
        self.assertEqual(STATE_ON, self.get_entity().state)
        self.assertEqual(fan.SPEED_HIGH,
                         self.get_entity().attributes[fan.ATTR_SPEED])