Update dependencies to receive data on webhook callbacks (#21838)

This commit is contained in:
Andrew Sayre 2019-03-08 23:20:07 -06:00 committed by Paulus Schoutsen
parent 113db9afd4
commit c5734eecc7
5 changed files with 24 additions and 12 deletions

View file

@ -344,16 +344,21 @@ async def test_broker_regenerates_token(
async def test_event_handler_dispatches_updated_devices(
hass, config_entry, device_factory, event_request_factory):
hass, config_entry, device_factory, event_request_factory,
event_factory):
"""Test the event handler dispatches updated devices."""
devices = [
device_factory('Bedroom 1 Switch', ['switch']),
device_factory('Bathroom 1', ['switch']),
device_factory('Sensor', ['motionSensor']),
device_factory('Lock', ['lock'])
]
device_ids = [devices[0].device_id, devices[1].device_id,
devices[2].device_id]
request = event_request_factory(device_ids)
devices[2].device_id, devices[3].device_id]
event = event_factory(devices[3].device_id, capability='lock',
attribute='lock', value='locked',
data={'codeId': '1'})
request = event_request_factory(device_ids=device_ids, events=[event])
config_entry.data[CONF_INSTALLED_APP_ID] = request.installed_app_id
called = False
@ -374,6 +379,8 @@ async def test_event_handler_dispatches_updated_devices(
assert called
for device in devices:
assert device.status.values['Updated'] == 'Value'
assert devices[3].status.attributes['lock'].value == 'locked'
assert devices[3].status.attributes['lock'].data == {'codeId': '1'}
async def test_event_handler_ignores_other_installed_app(
@ -417,7 +424,8 @@ async def test_event_handler_fires_button_events(
'device_id': device.device_id,
'location_id': event.location_id,
'value': 'pushed',
'name': device.label
'name': device.label,
'data': None
}
hass.bus.async_listen(EVENT_BUTTON, handler)
broker = smartthings.DeviceBroker(