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

This commit is contained in:
Andrew Sayre authored and Paulus Schoutsen committed 2019-03-12 11:51:00 -07:00
1 parent f3e8e34089
commit 39749952ee
5 files changed
+24 -12

No files matched your search

+12 -4
View File
@@ -235,16 +235,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
@@ -265,6 +270,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(
@@ -308,7 +315,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(