'Test notifications.'

def test_notification(self):

    events = []
    @callback
    def record_event(event):
        'Add    recorded    event    to    set.'
        events.append(event)
    self.hass.services.register(notify.DOMAIN, NOTIFIER, record_event)
    assert setup_component(self.hass, alert.DOMAIN, TEST_CONFIG)
    self.assertEqual(0, len(events))
    self.hass.states.set('sensor.test', STATE_ON)
    self.hass.block_till_done()
    self.assertEqual(1, len(events))
    self.hass.states.set('sensor.test', STATE_OFF)
    self.hass.block_till_done()
    self.assertEqual(2, len(events))
