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:
1 parent
53cbb28926
commit
df21dd21f2
30 files changed
+312
-186
No files matched your search
@@ -1,6 +1,9 @@
|
||||
"""Test deCONZ component setup process."""
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
import pytest
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.components import deconz
|
||||
|
||||
@@ -163,11 +166,13 @@ async def test_service_configure(hass):
|
||||
await hass.async_block_till_done()
|
||||
|
||||
# field does not start with /
|
||||
with patch('pydeconz.DeconzSession.async_put_state',
|
||||
return_value=mock_coro(True)):
|
||||
await hass.services.async_call('deconz', 'configure', service_data={
|
||||
'entity': 'light.test', 'field': 'state', 'data': data})
|
||||
await hass.async_block_till_done()
|
||||
with pytest.raises(vol.Invalid):
|
||||
with patch('pydeconz.DeconzSession.async_put_state',
|
||||
return_value=mock_coro(True)):
|
||||
await hass.services.async_call(
|
||||
'deconz', 'configure', service_data={
|
||||
'entity': 'light.test', 'field': 'state', 'data': data})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
|
||||
async def test_service_refresh_devices(hass):
|
||||
|
||||
Reference in new issue
Block a user