def test_is_on(self):
        """ Test is_on method. """
        self.assertTrue(group.is_on(self.hass, self.group_name))
        self.hass.states.set('light.Bowl', STATE_OFF)
        self.hass._pool.block_till_done()
        self.assertFalse(group.is_on(self.hass, self.group_name))

        # Try on non existing state
        self.assertFalse(group.is_on(self.hass, 'non.existing'))
Esempio n. 2
0
    def test_is_on(self):
        """ Test is_on method. """
        self.assertTrue(group.is_on(self.hass, self.group_entity_id))
        self.hass.states.set('light.Bowl', STATE_OFF)
        self.hass.pool.block_till_done()
        self.assertFalse(group.is_on(self.hass, self.group_entity_id))

        # Try on non existing state
        self.assertFalse(group.is_on(self.hass, 'non.existing'))
Esempio n. 3
0
    def test_is_on(self):
        """Test is_on method."""
        self.hass.states.set("light.Bowl", STATE_ON)
        self.hass.states.set("light.Ceiling", STATE_OFF)
        test_group = group.Group.create_group(self.hass, "init_group", ["light.Bowl", "light.Ceiling"], False)

        self.assertTrue(group.is_on(self.hass, test_group.entity_id))
        self.hass.states.set("light.Bowl", STATE_OFF)
        self.hass.block_till_done()
        self.assertFalse(group.is_on(self.hass, test_group.entity_id))

        # Try on non existing state
        self.assertFalse(group.is_on(self.hass, "non.existing"))
Esempio n. 4
0
    def test_is_on(self):
        """Test is_on method."""
        self.hass.states.set('light.Bowl', STATE_ON)
        self.hass.states.set('light.Ceiling', STATE_OFF)
        test_group = group.Group.create_group(
            self.hass, 'init_group', ['light.Bowl', 'light.Ceiling'], False)

        self.assertTrue(group.is_on(self.hass, test_group.entity_id))
        self.hass.states.set('light.Bowl', STATE_OFF)
        self.hass.block_till_done()
        self.assertFalse(group.is_on(self.hass, test_group.entity_id))

        # Try on non existing state
        self.assertFalse(group.is_on(self.hass, 'non.existing'))
Esempio n. 5
0
    def test_is_on(self):
        """Test is_on method."""
        self.hass.states.set('light.Bowl', STATE_ON)
        self.hass.states.set('light.Ceiling', STATE_OFF)
        test_group = group.Group(self.hass, 'init_group',
                                 ['light.Bowl', 'light.Ceiling'], False)

        self.assertTrue(group.is_on(self.hass, test_group.entity_id))
        self.hass.states.set('light.Bowl', STATE_OFF)
        self.hass.pool.block_till_done()
        self.assertFalse(group.is_on(self.hass, test_group.entity_id))

        # Try on non existing state
        self.assertFalse(group.is_on(self.hass, 'non.existing'))
Esempio n. 6
0
    def test_is_on(self):
        """Test is_on method."""
        self.hass.states.set("light.Bowl", STATE_ON)
        self.hass.states.set("light.Ceiling", STATE_OFF)
        test_group = group.Group.create_group(self.hass, "init_group",
                                              ["light.Bowl", "light.Ceiling"],
                                              False)

        assert group.is_on(self.hass, test_group.entity_id)
        self.hass.states.set("light.Bowl", STATE_OFF)
        self.hass.block_till_done()
        assert not group.is_on(self.hass, test_group.entity_id)

        # Try on non existing state
        assert not group.is_on(self.hass, "non.existing")
Esempio n. 7
0
    def test_is_on(self):
        """Test is_on method."""
        self.hass.states.set('light.Bowl', STATE_ON)
        self.hass.states.set('light.Ceiling', STATE_OFF)
        test_group = group.Group.create_group(self.hass, 'init_group',
                                              ['light.Bowl', 'light.Ceiling'],
                                              False)

        assert group.is_on(self.hass, test_group.entity_id)
        self.hass.states.set('light.Bowl', STATE_OFF)
        self.hass.block_till_done()
        assert not group.is_on(self.hass, test_group.entity_id)

        # Try on non existing state
        assert not group.is_on(self.hass, 'non.existing')
Esempio n. 8
0
async def test_is_on(hass):
    """Test is_on method."""
    hass.states.async_set("light.Bowl", STATE_ON)
    hass.states.async_set("light.Ceiling", STATE_OFF)

    assert group.is_on(hass, "group.none") is False
    assert await async_setup_component(hass, "light", {})
    assert await async_setup_component(hass, "group", {})
    await hass.async_block_till_done()

    test_group = await group.Group.async_create_group(
        hass, "init_group", ["light.Bowl", "light.Ceiling"], False)
    await hass.async_block_till_done()

    assert group.is_on(hass, test_group.entity_id) is True
    hass.states.async_set("light.Bowl", STATE_OFF)
    await hass.async_block_till_done()
    assert group.is_on(hass, test_group.entity_id) is False

    # Try on non existing state
    assert not group.is_on(hass, "non.existing")