def test_methods(self):
        """Test is_on, turn_on, turn_off methods."""
        self.assertTrue(setup_component(self.hass, DOMAIN, {DOMAIN: {
            'test_1': None,
        }}))
        entity_id = 'input_boolean.test_1'

        self.assertFalse(
            is_on(self.hass, entity_id))

        turn_on(self.hass, entity_id)

        self.hass.block_till_done()

        self.assertTrue(
            is_on(self.hass, entity_id))

        turn_off(self.hass, entity_id)

        self.hass.block_till_done()

        self.assertFalse(
            is_on(self.hass, entity_id))

        toggle(self.hass, entity_id)

        self.hass.block_till_done()

        self.assertTrue(is_on(self.hass, entity_id))
Ejemplo n.º 2
0
async def test_methods(hass):
    """Test is_on, turn_on, turn_off methods."""
    assert await async_setup_component(hass, DOMAIN,
                                       {DOMAIN: {
                                           "test_1": None
                                       }})
    entity_id = "input_boolean.test_1"

    assert not is_on(hass, entity_id)

    await hass.services.async_call(DOMAIN, SERVICE_TURN_ON,
                                   {ATTR_ENTITY_ID: entity_id})

    await hass.async_block_till_done()

    assert is_on(hass, entity_id)

    await hass.services.async_call(DOMAIN, SERVICE_TURN_OFF,
                                   {ATTR_ENTITY_ID: entity_id})

    await hass.async_block_till_done()

    assert not is_on(hass, entity_id)

    await hass.services.async_call(DOMAIN, SERVICE_TOGGLE,
                                   {ATTR_ENTITY_ID: entity_id})

    await hass.async_block_till_done()

    assert is_on(hass, entity_id)
Ejemplo n.º 3
0
    def test_methods(self):
        """Test is_on, turn_on, turn_off methods."""
        self.assertTrue(
            setup_component(self.hass, DOMAIN, {DOMAIN: {
                'test_1': None,
            }}))
        entity_id = 'input_boolean.test_1'

        self.assertFalse(is_on(self.hass, entity_id))

        turn_on(self.hass, entity_id)

        self.hass.block_till_done()

        self.assertTrue(is_on(self.hass, entity_id))

        turn_off(self.hass, entity_id)

        self.hass.block_till_done()

        self.assertFalse(is_on(self.hass, entity_id))

        toggle(self.hass, entity_id)

        self.hass.block_till_done()

        self.assertTrue(is_on(self.hass, entity_id))
    def test_methods(self):
        """ Test is_on, turn_on, turn_off methods. """
        self.assertTrue(input_boolean.setup(self.hass, {
            'input_boolean': {
                'test_1': None,
            }
        }))
        entity_id = 'input_boolean.test_1'

        self.assertFalse(
            input_boolean.is_on(self.hass, entity_id))

        input_boolean.turn_on(self.hass, entity_id)

        self.hass.pool.block_till_done()

        self.assertTrue(
            input_boolean.is_on(self.hass, entity_id))

        input_boolean.turn_off(self.hass, entity_id)

        self.hass.pool.block_till_done()

        self.assertFalse(
            input_boolean.is_on(self.hass, entity_id))
Ejemplo n.º 5
0
    def test_methods(self):
        """Test is_on, turn_on, turn_off methods."""
        assert setup_component(self.hass, DOMAIN, {DOMAIN: {
            'test_1': None,
        }})
        entity_id = 'input_boolean.test_1'

        assert not is_on(self.hass, entity_id)

        turn_on(self.hass, entity_id)

        self.hass.block_till_done()

        assert is_on(self.hass, entity_id)

        turn_off(self.hass, entity_id)

        self.hass.block_till_done()

        assert not is_on(self.hass, entity_id)

        toggle(self.hass, entity_id)

        self.hass.block_till_done()

        assert is_on(self.hass, entity_id)
Ejemplo n.º 6
0
    def test_methods(self):
        """ Test is_on, turn_on, turn_off methods. """
        self.assertTrue(
            input_boolean.setup(self.hass,
                                {'input_boolean': {
                                    'test_1': None,
                                }}))
        entity_id = 'input_boolean.test_1'

        self.assertFalse(input_boolean.is_on(self.hass, entity_id))

        input_boolean.turn_on(self.hass, entity_id)

        self.hass.pool.block_till_done()

        self.assertTrue(input_boolean.is_on(self.hass, entity_id))

        input_boolean.turn_off(self.hass, entity_id)

        self.hass.pool.block_till_done()

        self.assertFalse(input_boolean.is_on(self.hass, entity_id))