def test_set_entity_namespace_via_config(self):
    'Test setting an entity namespace.'

    def platform_setup(hass, config, add_entities, discovery_info=None):
        'Test the platform setup.'
        add_entities([MockEntity(name='beer'), MockEntity(name=None)])
    platform = MockPlatform(platform_setup)
    mock_entity_platform(self.hass, 'test_domain.platform', platform)
    component = EntityComponent(_LOGGER, DOMAIN, self.hass)
    component.setup({DOMAIN: {'platform': 'platform', 'entity_namespace': 'yummy'}})
    self.hass.block_till_done()
    assert (sorted(self.hass.states.entity_ids()) == ['test_domain.yummy_beer', 'test_domain.yummy_unnamed_device'])
Test setting an entity namespace.
def test_set_entity_namespace_via_config(self):
    

    def platform_setup(hass, config, add_entities, discovery_info=None):
        'Test the platform setup.'
        add_entities([MockEntity(name='beer'), MockEntity(name=None)])
    platform = MockPlatform(platform_setup)
    mock_entity_platform(self.hass, 'test_domain.platform', platform)
    component = EntityComponent(_LOGGER, DOMAIN, self.hass)
    component.setup({DOMAIN: {'platform': 'platform', 'entity_namespace': 'yummy'}})
    self.hass.block_till_done()
    assert (sorted(self.hass.states.entity_ids()) == ['test_domain.yummy_beer', 'test_domain.yummy_unnamed_device'])