Beispiel #1
0
    def test_is_on(self):
        """Test is_on."""
        self.hass.states.set("remote.test", STATE_ON)
        assert remote.is_on(self.hass, "remote.test")

        self.hass.states.set("remote.test", STATE_OFF)
        assert not remote.is_on(self.hass, "remote.test")
async def test_is_on(hass):
    """Test is_on."""
    hass.states.async_set("remote.test", STATE_ON)
    assert remote.is_on(hass, "remote.test")

    hass.states.async_set("remote.test", STATE_OFF)
    assert not remote.is_on(hass, "remote.test")
Beispiel #3
0
    def test_is_on(self):
        """Test is_on."""
        self.hass.states.set('remote.test', STATE_ON)
        self.assertTrue(remote.is_on(self.hass, 'remote.test'))

        self.hass.states.set('remote.test', STATE_OFF)
        self.assertFalse(remote.is_on(self.hass, 'remote.test'))

        self.hass.states.set(remote.ENTITY_ID_ALL_REMOTES, STATE_ON)
        self.assertTrue(remote.is_on(self.hass))

        self.hass.states.set(remote.ENTITY_ID_ALL_REMOTES, STATE_OFF)
        self.assertFalse(remote.is_on(self.hass))
    def test_is_on(self):
        """Test is_on."""
        self.hass.states.set("remote.test", STATE_ON)
        assert remote.is_on(self.hass, "remote.test")

        self.hass.states.set("remote.test", STATE_OFF)
        assert not remote.is_on(self.hass, "remote.test")

        self.hass.states.set(remote.ENTITY_ID_ALL_REMOTES, STATE_ON)
        assert remote.is_on(self.hass)

        self.hass.states.set(remote.ENTITY_ID_ALL_REMOTES, STATE_OFF)
        assert not remote.is_on(self.hass)
Beispiel #5
0
    def test_is_on(self):
        """Test is_on."""
        self.hass.states.set('remote.test', STATE_ON)
        assert remote.is_on(self.hass, 'remote.test')

        self.hass.states.set('remote.test', STATE_OFF)
        assert not remote.is_on(self.hass, 'remote.test')

        self.hass.states.set(remote.ENTITY_ID_ALL_REMOTES, STATE_ON)
        assert remote.is_on(self.hass)

        self.hass.states.set(remote.ENTITY_ID_ALL_REMOTES, STATE_OFF)
        assert not remote.is_on(self.hass)
Beispiel #6
0
    def test_is_on(self):
        """ Test is_on"""
        self.hass.states.set('remote.test', STATE_ON)
        self.assertTrue(remote.is_on(self.hass, 'remote.test'))

        self.hass.states.set('remote.test', STATE_OFF)
        self.assertFalse(remote.is_on(self.hass, 'remote.test'))

        self.hass.states.set(remote.ENTITY_ID_ALL_REMOTES, STATE_ON)
        self.assertTrue(remote.is_on(self.hass))

        self.hass.states.set(remote.ENTITY_ID_ALL_REMOTES, STATE_OFF)
        self.assertFalse(remote.is_on(self.hass))
Beispiel #7
0
    def test_methods(self):
        """Test if methods call the services as expected."""
        self.assertTrue(
            setup_component(self.hass, remote.DOMAIN,
                            {remote.DOMAIN: {CONF_PLATFORM: 'demo'}}))

        # Test is_on
        self.hass.states.set('remote.demo', STATE_ON)
        self.assertTrue(remote.is_on(self.hass, 'remote.demo'))

        self.hass.states.set('remote.demo', STATE_OFF)
        self.assertFalse(remote.is_on(self.hass, 'remote.demo'))

        self.hass.states.set(remote.ENTITY_ID_ALL_REMOTES, STATE_ON)
        self.assertTrue(remote.is_on(self.hass))

        self.hass.states.set(remote.ENTITY_ID_ALL_REMOTES, STATE_OFF)
        self.assertFalse(remote.is_on(self.hass))
Beispiel #8
0
    def test_methods(self):
        """Test if methods call the services as expected."""
        self.assertTrue(
            setup_component(self.hass, remote.DOMAIN,
                            {remote.DOMAIN: {CONF_PLATFORM: 'demo'}}))

        # Test is_on
        self.hass.states.set('remote.demo', STATE_ON)
        self.assertTrue(remote.is_on(self.hass, 'remote.demo'))

        self.hass.states.set('remote.demo', STATE_OFF)
        self.assertFalse(remote.is_on(self.hass, 'remote.demo'))

        self.hass.states.set(remote.ENTITY_ID_ALL_REMOTES, STATE_ON)
        self.assertTrue(remote.is_on(self.hass))

        self.hass.states.set(remote.ENTITY_ID_ALL_REMOTES, STATE_OFF)
        self.assertFalse(remote.is_on(self.hass))