Add permissions check in service helper (#18596)
* Add permissions check in service helper * Lint * Fix tests * Lint * Typing * Fix unused impoert
This commit is contained in:
1 parent
8aa2cefd75
commit
36c31a6293
14 files changed
+268
-46
No files matched your search
@@ -147,7 +147,7 @@ def test_initial_state_overrules_restore_state(hass):
|
||||
assert state.state == 'on'
|
||||
|
||||
|
||||
async def test_input_boolean_context(hass):
|
||||
async def test_input_boolean_context(hass, hass_admin_user):
|
||||
"""Test that input_boolean context works."""
|
||||
assert await async_setup_component(hass, 'input_boolean', {
|
||||
'input_boolean': {
|
||||
@@ -160,9 +160,9 @@ async def test_input_boolean_context(hass):
|
||||
|
||||
await hass.services.async_call('input_boolean', 'turn_off', {
|
||||
'entity_id': state.entity_id,
|
||||
}, True, Context(user_id='abcd'))
|
||||
}, True, Context(user_id=hass_admin_user.id))
|
||||
|
||||
state2 = hass.states.get('input_boolean.ac')
|
||||
assert state2 is not None
|
||||
assert state.state != state2.state
|
||||
assert state2.context.user_id == 'abcd'
|
||||
assert state2.context.user_id == hass_admin_user.id
|
||||
Reference in new issue
Block a user