Fix broken tests + linting
This commit is contained in:
1 parent
a91f937245
commit
3ac31b2c1b
5 files changed
+18
-19
No files matched your search
@@ -2,7 +2,7 @@
|
||||
import unittest
|
||||
from unittest import mock
|
||||
|
||||
from homeassistant.const import EVENT_STATE_CHANGED
|
||||
from homeassistant.const import EVENT_STATE_CHANGED, MATCH_ALL
|
||||
from homeassistant.components.binary_sensor import template
|
||||
from homeassistant.exceptions import TemplateError
|
||||
|
||||
@@ -29,7 +29,7 @@ class TestBinarySensorTemplate(unittest.TestCase):
|
||||
result = template.setup_platform(hass, config, add_devices)
|
||||
self.assertTrue(result)
|
||||
mock_template.assert_called_once_with(hass, 'test', 'virtual thingy',
|
||||
'motion', '{{ foo }}', None)
|
||||
'motion', '{{ foo }}', MATCH_ALL)
|
||||
add_devices.assert_called_once_with([mock_template.return_value])
|
||||
|
||||
def test_setup_no_sensors(self):
|
||||
@@ -77,7 +77,7 @@ class TestBinarySensorTemplate(unittest.TestCase):
|
||||
""""Test the attributes."""
|
||||
hass = mock.MagicMock()
|
||||
vs = template.BinarySensorTemplate(hass, 'parent', 'Parent',
|
||||
'motion', '{{ 1 > 1 }}', None)
|
||||
'motion', '{{ 1 > 1 }}', MATCH_ALL)
|
||||
self.assertFalse(vs.should_poll)
|
||||
self.assertEqual('motion', vs.sensor_class)
|
||||
self.assertEqual('Parent', vs.name)
|
||||
@@ -93,7 +93,7 @@ class TestBinarySensorTemplate(unittest.TestCase):
|
||||
""""Test the event."""
|
||||
hass = get_test_home_assistant()
|
||||
vs = template.BinarySensorTemplate(hass, 'parent', 'Parent',
|
||||
'motion', '{{ 1 > 1 }}', None)
|
||||
'motion', '{{ 1 > 1 }}', MATCH_ALL)
|
||||
vs.update_ha_state()
|
||||
hass.pool.block_till_done()
|
||||
|
||||
@@ -110,7 +110,7 @@ class TestBinarySensorTemplate(unittest.TestCase):
|
||||
""""Test the template update error."""
|
||||
hass = mock.MagicMock()
|
||||
vs = template.BinarySensorTemplate(hass, 'parent', 'Parent',
|
||||
'motion', '{{ 1 > 1 }}', None)
|
||||
'motion', '{{ 1 > 1 }}', MATCH_ALL)
|
||||
mock_render.side_effect = TemplateError('foo')
|
||||
vs.update()
|
||||
mock_render.side_effect = TemplateError(
|
||||
|
||||
Reference in new issue
Block a user