'L{task.react} runs the reactor until the L{Deferred} returned by the
function it is passed is called back, then stops it.'

def test_runsUntilAsyncCallback(self):

    timePassed = []
    def main(reactor):
        finished = defer.Deferred()
        reactor.callLater(1, timePassed.append, True)
        reactor.callLater(2, finished.callback, None)
        return finished
    r = _FakeReactor()
    exitError = self.assertRaises(SystemExit, task.react, main, _reactor=r)
    self.assertEqual(0, exitError.code)
    self.assertEqual(timePassed, [True])
    self.assertEqual(r.seconds(), 2)
