Catch exceptions when error rendering templates
This commit is contained in:
1 parent
5c63862054
commit
b1bf6a609e
3 files changed
+28
-5
No files matched your search
@@ -7,7 +7,7 @@ Tests Home Assistant util methods.
|
||||
# pylint: disable=too-many-public-methods
|
||||
import unittest
|
||||
import homeassistant.core as ha
|
||||
|
||||
from homeassistant.exceptions import TemplateError
|
||||
from homeassistant.util import template
|
||||
|
||||
|
||||
@@ -84,3 +84,7 @@ class TestUtilTemplate(unittest.TestCase):
|
||||
'',
|
||||
template.render_with_possible_json_value(
|
||||
self.hass, '{{ value_json }}', '{ I AM NOT JSON }'))
|
||||
|
||||
def test_raise_exception_on_error(self):
|
||||
with self.assertRaises(TemplateError):
|
||||
template.render(self.hass, '{{ invalid_syntax')
|
||||
Reference in new issue
Block a user