'If a trigger added to the C{\'before\'} phase of an event returns a
L{Deferred}, the C{\'during\'} phase should be delayed until it is called
back.'

def test_beforeReturnsDeferred(self):

    triggerDeferred = Deferred()
    eventType = 'test'
    events = []
    def beforeTrigger():
        return triggerDeferred
    def duringTrigger():
        events.append('during')
    self.addTrigger('before', eventType, beforeTrigger)
    self.addTrigger('during', eventType, duringTrigger)
    self.assertEqual(events, [])
    reactor.fireSystemEvent(eventType)
    self.assertEqual(events, [])
    triggerDeferred.callback(None)
    self.assertEqual(events, ['during'])
