예제 #1
0
    def test_reloading_groups(self):
        """Test reloading the group config."""
        assert setup_component(self.hass, 'group', {'group': {
                    'second_group': {
                        'entities': 'light.Bowl',
                        'icon': 'mdi:work',
                        'view': True,
                    },
                    'test_group': 'hello.world,sensor.happy',
                    'empty_group': {'name': 'Empty Group', 'entities': None},
                }
            })

        assert sorted(self.hass.states.entity_ids()) == \
            ['group.empty_group', 'group.second_group', 'group.test_group']
        assert self.hass.bus.listeners['state_changed'] == 3

        with patch('homeassistant.config.load_yaml_config_file', return_value={
                'group': {
                    'hello': {
                        'entities': 'light.Bowl',
                        'icon': 'mdi:work',
                        'view': True,
                    }}}):
            group.reload(self.hass)
            self.hass.block_till_done()

        assert self.hass.states.entity_ids() == ['group.hello']
        assert self.hass.bus.listeners['state_changed'] == 1
예제 #2
0
    def test_reloading_groups(self):
        """Test reloading the group config."""
        assert setup_component(self.hass, 'group', {'group': {
            'second_group': {
                'entities': 'light.Bowl',
                'icon': 'mdi:work',
                'view': True,
            },
            'test_group': 'hello.world,sensor.happy',
            'empty_group': {'name': 'Empty Group', 'entities': None},
        }})

        assert sorted(self.hass.states.entity_ids()) == \
            ['group.empty_group', 'group.second_group', 'group.test_group']
        assert self.hass.bus.listeners['state_changed'] == 2

        with patch('homeassistant.config.load_yaml_config_file', return_value={
            'group': {
                'hello': {
                    'entities': 'light.Bowl',
                    'icon': 'mdi:work',
                    'view': True,
                }}}):
            group.reload(self.hass)
            self.hass.block_till_done()

        assert self.hass.states.entity_ids() == ['group.hello']
        assert self.hass.bus.listeners['state_changed'] == 1
예제 #3
0
    def test_reloading_groups(self):
        """Test reloading the group config."""
        assert setup_component(
            self.hass,
            "group",
            {
                "group": {
                    "second_group": {"entities": "light.Bowl", "icon": "mdi:work", "view": True},
                    "test_group": "hello.world,sensor.happy",
                    "empty_group": {"name": "Empty Group", "entities": None},
                }
            },
        )

        assert sorted(self.hass.states.entity_ids()) == ["group.empty_group", "group.second_group", "group.test_group"]
        assert self.hass.bus.listeners["state_changed"] == 3

        with patch(
            "homeassistant.config.load_yaml_config_file",
            return_value={"group": {"hello": {"entities": "light.Bowl", "icon": "mdi:work", "view": True}}},
        ):
            group.reload(self.hass)
            self.hass.block_till_done()

        assert self.hass.states.entity_ids() == ["group.hello"]
        assert self.hass.bus.listeners["state_changed"] == 1