Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak visibility config #98

Merged
merged 4 commits into from
Apr 23, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clean up Entity helper test code
  • Loading branch information
balloob committed Apr 23, 2015
commit 8f36cf3c8119b12f4de6330ccc14af606a4f7451
13 changes: 2 additions & 11 deletions tests/test_helper_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ def setUp(self): # pylint: disable=invalid-name
self.entity = entity.Entity()
self.entity.entity_id = 'test.overwrite_hidden_true'
self.hass = self.entity.hass = ha.HomeAssistant()
self.entity.update_ha_state()

def tearDown(self): # pylint: disable=invalid-name
""" Stop down stuff we started. """
self.hass.stop()
entity.Entity.overwrite_hidden(self.entity.entity_id, None)

def test_default_hidden_not_in_attributes(self):
""" Test that the default hidden property is set to False. """
self.entity.update_ha_state()

self.assertNotIn(
ATTR_HIDDEN,
self.hass.states.get(self.entity.entity_id).attributes)
Expand All @@ -41,29 +41,20 @@ def test_setting_hidden_to_true(self):

self.assertTrue(state.attributes.get(ATTR_HIDDEN))

self.entity.hidden = False

def test_overwriting_hidden_property_to_true(self):
""" Test we can overwrite hidden property to True. """
entity.Entity.overwrite_hidden(self.entity.entity_id, True)

self.entity.update_ha_state()

state = self.hass.states.get(self.entity.entity_id)

self.assertTrue(state.attributes.get(ATTR_HIDDEN))

entity.Entity.overwrite_hidden(self.entity.entity_id, None)

def test_overwriting_hidden_property_to_false(self):
""" Test we can overwrite hidden property to True. """
entity.Entity.overwrite_hidden(self.entity.entity_id, False)

self.entity.hidden = True
self.entity.update_ha_state()

self.assertNotIn(
ATTR_HIDDEN,
self.hass.states.get(self.entity.entity_id).attributes)

entity.Entity.overwrite_hidden(self.entity.entity_id, None)