'Test adding, then removing, then adding an event handler.'

def testAddDelAddEvent(self):

    happened = []
    def handletestevent(event):
        happened.append(True)
    self.xmpp.add_event_handler('test_event', handletestevent)
    self.xmpp.event('test_event', {})
    self.xmpp.del_event_handler('test_event', handletestevent)
    self.xmpp.event('test_event', {})
    self.xmpp.add_event_handler('test_event', handletestevent)
    self.xmpp.event('test_event', {})
    time.sleep(0.1)
    msg = 'Event    was    not    triggered    the    correct    number    of    times:    %s'
    self.failUnless((happened == [True, True]), (msg % happened))
