コード例 #1
0
 def test_is_on(self):
     """Test is_on method."""
     self.hass.states.set(ENTITY_ID, STATE_ON)
     self.hass.block_till_done()
     self.assertTrue(alert.is_on(self.hass, ENTITY_ID))
     self.hass.states.set(ENTITY_ID, STATE_OFF)
     self.hass.block_till_done()
     self.assertFalse(alert.is_on(self.hass, ENTITY_ID))
コード例 #2
0
ファイル: test_alert.py プロジェクト: nunofgs/home-assistant
 def test_is_on(self):
     """Test is_on method."""
     self.hass.states.set(ENTITY_ID, STATE_ON)
     self.hass.block_till_done()
     self.assertTrue(alert.is_on(self.hass, ENTITY_ID))
     self.hass.states.set(ENTITY_ID, STATE_OFF)
     self.hass.block_till_done()
     self.assertFalse(alert.is_on(self.hass, ENTITY_ID))
コード例 #3
0
ファイル: test_init.py プロジェクト: pkrolkgp/home-assistant
 def test_is_on(self):
     """Test is_on method."""
     self.hass.states.set(ENTITY_ID, STATE_ON)
     self.hass.block_till_done()
     assert alert.is_on(self.hass, ENTITY_ID)
     self.hass.states.set(ENTITY_ID, STATE_OFF)
     self.hass.block_till_done()
     assert not alert.is_on(self.hass, ENTITY_ID)
コード例 #4
0
async def test_is_on(hass):
    """Test is_on method."""
    hass.states.async_set(ENTITY_ID, STATE_ON)
    await hass.async_block_till_done()
    assert alert.is_on(hass, ENTITY_ID)
    hass.states.async_set(ENTITY_ID, STATE_OFF)
    await hass.async_block_till_done()
    assert not alert.is_on(hass, ENTITY_ID)
コード例 #5
0
ファイル: test_init.py プロジェクト: Martwall/home-assistant
 def test_is_on(self):
     """Test is_on method."""
     self.hass.states.set(ENTITY_ID, STATE_ON)
     self.hass.block_till_done()
     assert alert.is_on(self.hass, ENTITY_ID)
     self.hass.states.set(ENTITY_ID, STATE_OFF)
     self.hass.block_till_done()
     assert not alert.is_on(self.hass, ENTITY_ID)