RFC: Call services directly (#18720)

* Call services directly

* Simplify

* Type

* Lint

* Update name

* Fix tests

* Catch exceptions in HTTP view

* Lint

* Handle ServiceNotFound in API endpoints that call services

* Type

* Don't crash recorder on non-JSON serializable objects
This commit is contained in:
Paulus Schoutsen authored and Pascal Vizeli committed 2018-11-30 21:28:35 +01:00
1 parent 53cbb28926
commit df21dd21f2
30 files changed
+312 -186

No files matched your search

+5 -1
View File
@@ -2,6 +2,9 @@
import unittest
from unittest.mock import patch
import pytest
import voluptuous as vol
import homeassistant.components.notify as notify
from homeassistant.setup import setup_component
from homeassistant.components.notify import demo
@@ -81,7 +84,8 @@ class TestNotifyDemo(unittest.TestCase):
def test_sending_none_message(self):
"""Test send with None as message."""
self._setup_notify()
common.send_message(self.hass, None)
with pytest.raises(vol.Invalid):
common.send_message(self.hass, None)
self.hass.block_till_done()
assert len(self.events) == 0