ps - add reload core config service (#2350)
This commit is contained in:
parent
9ce9b8debb
commit
a70f922a71
6 changed files with 156 additions and 54 deletions
|
@ -21,8 +21,7 @@ class TestHelpersEntity(unittest.TestCase):
|
|||
def tearDown(self): # pylint: disable=invalid-name
|
||||
"""Stop everything that was started."""
|
||||
self.hass.stop()
|
||||
entity.Entity.overwrite_attribute(self.entity.entity_id,
|
||||
[ATTR_HIDDEN], [None])
|
||||
entity.set_customize({})
|
||||
|
||||
def test_default_hidden_not_in_attributes(self):
|
||||
"""Test that the default hidden property is set to False."""
|
||||
|
@ -32,8 +31,7 @@ class TestHelpersEntity(unittest.TestCase):
|
|||
|
||||
def test_overwriting_hidden_property_to_true(self):
|
||||
"""Test we can overwrite hidden property to True."""
|
||||
entity.Entity.overwrite_attribute(self.entity.entity_id,
|
||||
[ATTR_HIDDEN], [True])
|
||||
entity.set_customize({self.entity.entity_id: {ATTR_HIDDEN: True}})
|
||||
self.entity.update_ha_state()
|
||||
|
||||
state = self.hass.states.get(self.entity.entity_id)
|
||||
|
@ -43,3 +41,30 @@ class TestHelpersEntity(unittest.TestCase):
|
|||
"""Test split_entity_id."""
|
||||
self.assertEqual(['domain', 'object_id'],
|
||||
entity.split_entity_id('domain.object_id'))
|
||||
|
||||
def test_generate_entity_id_requires_hass_or_ids(self):
|
||||
"""Ensure we require at least hass or current ids."""
|
||||
fmt = 'test.{}'
|
||||
with self.assertRaises(ValueError):
|
||||
entity.generate_entity_id(fmt, 'hello world')
|
||||
|
||||
def test_generate_entity_id_given_hass(self):
|
||||
"""Test generating an entity id given hass object."""
|
||||
fmt = 'test.{}'
|
||||
self.assertEqual(
|
||||
'test.overwrite_hidden_true_2',
|
||||
entity.generate_entity_id(fmt, 'overwrite hidden true',
|
||||
hass=self.hass))
|
||||
|
||||
def test_generate_entity_id_given_keys(self):
|
||||
"""Test generating an entity id given current ids."""
|
||||
fmt = 'test.{}'
|
||||
self.assertEqual(
|
||||
'test.overwrite_hidden_true_2',
|
||||
entity.generate_entity_id(
|
||||
fmt, 'overwrite hidden true',
|
||||
current_ids=['test.overwrite_hidden_true']))
|
||||
self.assertEqual(
|
||||
'test.overwrite_hidden_true',
|
||||
entity.generate_entity_id(fmt, 'overwrite hidden true',
|
||||
current_ids=['test.another_entity']))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue