async def test_webhook_handle_fire_event(hass, create_registrations, webhook_client):
    'Test that we can fire events.'
    events = []

    @callback
    def store_event(event):
        'Helepr to store events.'
        events.append(event)
    hass.bus.async_listen('test_event', store_event)
    resp = (await webhook_client.post('/api/webhook/{}'.format(create_registrations[1]['webhook_id']), json=FIRE_EVENT))
    assert (resp.status == 200)
    json = (await resp.json())
    assert (json == {})
    assert (len(events) == 1)
    assert (events[0].data['hello'] == 'yo world')
Test that we can fire events.
async def test_webhook_handle_fire_event(hass, create_registrations, webhook_client):
    
    events = []

    @callback
    def store_event(event):
        'Helepr to store events.'
        events.append(event)
    hass.bus.async_listen('test_event', store_event)
    resp = (await webhook_client.post('/api/webhook/{}'.format(create_registrations[1]['webhook_id']), json=FIRE_EVENT))
    assert (resp.status == 200)
    json = (await resp.json())
    assert (json == {})
    assert (len(events) == 1)
    assert (events[0].data['hello'] == 'yo world')