def test_done(self): """ When the process exits successfully, it's a callback rather than an errback """ p = SimpleProtocol('foo') p.processEnded(failure.Failure(error.ProcessDone('foo'))) def check(res): self.assertEqual(res, p) return p.done.addCallback(check)
def test_done_error(self): """ If the process exits with an error code, that's an error. """ p = SimpleProtocol('foo') p.processEnded(failure.Failure(error.ProcessTerminated(12, 'kill'))) def eb(res): pass def cb(res): self.fail('should have been an error') return p.done.addCallbacks(cb, eb)