'Test the firing of events.'

def test_firing_event(self):

    event = 'test_event'
    calls = []
    @callback
    def record_event(event):
        'Add    recorded    event    to    set.'
        calls.append(event)
    self.hass.bus.listen(event, record_event)
    script_obj = script.Script(self.hass, cv.SCRIPT_SCHEMA({'event': event, 'event_data': {'hello': 'world'}}))
    script_obj.run()
    self.hass.block_till_done()
    assert (len(calls) == 1)
    assert (calls[0].data.get('hello') == 'world')
    assert (not script_obj.can_cancel)
