2014-11-29 06:49:29 +00:00
|
|
|
"""
|
2015-01-09 04:05:12 +00:00
|
|
|
tests.test_component_demo
|
2014-12-01 07:14:08 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2014-11-29 06:49:29 +00:00
|
|
|
|
|
|
|
Tests demo component.
|
|
|
|
"""
|
|
|
|
import unittest
|
|
|
|
|
|
|
|
import homeassistant as ha
|
|
|
|
import homeassistant.components.demo as demo
|
|
|
|
|
|
|
|
|
|
|
|
class TestDemo(unittest.TestCase):
|
|
|
|
""" Test the demo module. """
|
|
|
|
|
|
|
|
def setUp(self): # pylint: disable=invalid-name
|
|
|
|
self.hass = ha.HomeAssistant()
|
|
|
|
|
|
|
|
def tearDown(self): # pylint: disable=invalid-name
|
|
|
|
""" Stop down stuff we started. """
|
|
|
|
self.hass.stop()
|
|
|
|
|
2015-03-17 05:20:31 +00:00
|
|
|
def test_if_demo_state_shows_by_default(self):
|
|
|
|
""" Test if demo state shows if we give no configuration. """
|
|
|
|
demo.setup(self.hass, {demo.DOMAIN: {}})
|
|
|
|
|
|
|
|
self.assertIsNotNone(self.hass.states.get('a.Demo_Mode'))
|
|
|
|
|
2014-11-29 06:49:29 +00:00
|
|
|
def test_hiding_demo_state(self):
|
|
|
|
""" Test if you can hide the demo card. """
|
2015-03-17 05:20:31 +00:00
|
|
|
demo.setup(self.hass, {demo.DOMAIN: {'hide_demo_state': 1}})
|
2014-11-29 06:49:29 +00:00
|
|
|
|
|
|
|
self.assertIsNone(self.hass.states.get('a.Demo_Mode'))
|