Use voluptuous for Command line platforms (#2968)
* Migrate to voluptuous * Fix pylint issues * Remove FIXME * Split setup test * Test with bootstrap * Remove lon and lat * Fix pylint issues
This commit is contained in:
parent
81628b01c2
commit
40c71b5d96
11 changed files with 199 additions and 134 deletions
|
@ -2,13 +2,12 @@
|
|||
import os
|
||||
import tempfile
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
import homeassistant.components.notify as notify
|
||||
|
||||
from homeassistant import bootstrap
|
||||
from tests.common import get_test_home_assistant
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
|
||||
class TestCommandLine(unittest.TestCase):
|
||||
"""Test the command line notifications."""
|
||||
|
@ -21,20 +20,23 @@ class TestCommandLine(unittest.TestCase):
|
|||
"""Stop down everything that was started."""
|
||||
self.hass.stop()
|
||||
|
||||
def test_setup(self):
|
||||
"""Test setup."""
|
||||
assert bootstrap.setup_component(self.hass, 'notify', {
|
||||
'notify': {
|
||||
'name': 'test',
|
||||
'platform': 'command_line',
|
||||
'command': 'echo $(cat); exit 1',
|
||||
}})
|
||||
|
||||
def test_bad_config(self):
|
||||
"""Test set up the platform with bad/missing config."""
|
||||
"""Test set up the platform with bad/missing configuration."""
|
||||
self.assertFalse(notify.setup(self.hass, {
|
||||
'notify': {
|
||||
'name': 'test',
|
||||
'platform': 'bad_platform',
|
||||
}
|
||||
}))
|
||||
self.assertFalse(notify.setup(self.hass, {
|
||||
'notify': {
|
||||
'name': 'test',
|
||||
'platform': 'command_line',
|
||||
}
|
||||
}))
|
||||
|
||||
def test_command_line_output(self):
|
||||
"""Test the command line output."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue