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

+3 -3
View File
@@ -61,6 +61,7 @@ async def test_validating_mfa_counter(hass):
'counter': 0,
'notify_service': 'dummy',
})
async_mock_service(hass, 'notify', 'dummy')
assert notify_auth_module._user_settings
notify_setting = list(notify_auth_module._user_settings.values())[0]
@@ -389,9 +390,8 @@ async def test_not_raise_exception_when_service_not_exist(hass):
'username': 'test-user',
'password': 'test-pass',
})
assert result['type'] == data_entry_flow.RESULT_TYPE_FORM
assert result['step_id'] == 'mfa'
assert result['data_schema'].schema.get('code') == str
assert result['type'] == data_entry_flow.RESULT_TYPE_ABORT
assert result['reason'] == 'unknown_error'
# wait service call finished
await hass.async_block_till_done()