forked from home-assistant/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated coveragec, cleaned up constants, added test for demo.
- Loading branch information
Showing
4 changed files
with
60 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
""" | ||
tests.components.garage_door.test_demo | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
Tests demo garage door component. | ||
""" | ||
import unittest | ||
|
||
import homeassistant.core as ha | ||
from homeassistant.components import garage_door | ||
|
||
|
||
LEFT = 'garage_door.left_garage_door' | ||
RIGHT = 'garage_door.right_garage_door' | ||
|
||
|
||
class TestGarageDoorDemo(unittest.TestCase): | ||
""" Test the demo garage door. """ | ||
|
||
def setUp(self): # pylint: disable=invalid-name | ||
self.hass = ha.HomeAssistant() | ||
self.assertTrue(garage_door.setup(self.hass, { | ||
'garage_door': { | ||
'platform': 'demo' | ||
} | ||
})) | ||
|
||
def tearDown(self): # pylint: disable=invalid-name | ||
""" Stop down stuff we started. """ | ||
self.hass.stop() | ||
|
||
def test_is_closed(self): | ||
self.assertTrue(garage_door.is_closed(self.hass, LEFT)) | ||
self.hass.states.is_state(LEFT, 'close') | ||
|
||
self.assertFalse(garage_door.is_closed(self.hass, RIGHT)) | ||
self.hass.states.is_state(RIGHT, 'open') | ||
|
||
def test_open_door(self): | ||
garage_door.open_door(self.hass, LEFT) | ||
|
||
self.hass.pool.block_till_done() | ||
|
||
self.assertFalse(garage_door.is_closed(self.hass, LEFT)) | ||
|
||
def test_close_door(self): | ||
garage_door.close_door(self.hass, RIGHT) | ||
|
||
self.hass.pool.block_till_done() | ||
|
||
self.assertTrue(garage_door.is_closed(self.hass, RIGHT)) |