示例#1
0
 def testTransmitIntentSetResult(self):
     ti = TransmitIntent('addr', 'msg')
     self.assertEqual(None, ti.result)
     ti.result = SendStatus.Sent
     self.assertEqual(ti.result, SendStatus.Sent)
     ti.result = SendStatus.Failed
     self.assertEqual(ti.result, SendStatus.Failed)
示例#2
0
 def testTransmitIntentSetResult(self):
     ti = TransmitIntent('addr', 'msg')
     assert None == ti.result
     ti.result = SendStatus.Sent
     assert ti.result == SendStatus.Sent
     ti.result = SendStatus.Failed
     assert ti.result == SendStatus.Failed
示例#3
0
 def testTransmitIntentSetResult(self):
     ti = TransmitIntent('addr', 'msg')
     assert None == ti.result
     ti.result = SendStatus.Sent
     assert ti.result == SendStatus.Sent
     ti.result = SendStatus.Failed
     assert ti.result == SendStatus.Failed
示例#4
0
 def testTransmitIntentSetResult(self):
     ti = TransmitIntent('addr', 'msg')
     self.assertEqual(None, ti.result)
     ti.result = SendStatus.Sent
     self.assertEqual(ti.result, SendStatus.Sent)
     ti.result = SendStatus.Failed
     self.assertEqual(ti.result, SendStatus.Failed)
示例#5
0
 def testTransmitIntentCallbackFailureFailed(self):
     ti = TransmitIntent('addr', 'msg')
     ti.result = SendStatus.Failed
     # Ensure no exception thrown
     ti.completionCallback()
     # And again
     ti.completionCallback()
示例#6
0
 def testTransmitIntentCallbackFailureFailed(self):
     ti = TransmitIntent('addr', 'msg')
     ti.result = SendStatus.Failed
     # Ensure no exception thrown
     ti.completionCallback()
     # And again
     ti.completionCallback()
示例#7
0
 def testTransmitIntentCallbackFailureFailedWithTarget(self):
     self.successes = []
     self.failures = []
     ti = TransmitIntent('addr', 'msg', onSuccess = self._success, onError = self._failed)
     ti.result = SendStatus.Failed
     # Ensure no exception thrown
     ti.completionCallback()
     self.assertEqual(self.successes, [])
     self.assertEqual(self.failures, [(SendStatus.Failed, ti)])
     # And again
     ti.completionCallback()
     self.assertEqual(self.successes, [])
     self.assertEqual(self.failures, [(SendStatus.Failed, ti)])
示例#8
0
 def testTransmitIntentCallbackFailureNotSentWithChangedTargetsAdded(self):
     self.successes = []
     self.failures = []
     ti = TransmitIntent('addr', 'msg', onSuccess = self._success, onError = self._failed)
     ti.result = SendStatus.NotSent
     # Ensure no exception thrown
     ti.completionCallback()
     self.assertEqual(self.successes, [])
     self.assertEqual(self.failures, [(SendStatus.NotSent, ti)])
     # And again
     ti.addCallback(self._success, self._failed)
     ti.completionCallback()
     self.assertEqual(self.successes, [])
     self.assertEqual(self.failures, [(SendStatus.NotSent, ti), (SendStatus.NotSent, ti)])
示例#9
0
 def testTransmitIntentCallbackFailureNotSentWithTarget(self):
     self.successes = []
     self.failures = []
     ti = TransmitIntent('addr', 'msg',
                         onSuccess = self._success,
                         onError = self._failed)
     ti.result = SendStatus.NotSent
     # Ensure no exception thrown
     ti.completionCallback()
     assert self.successes == []
     assert self.failures == [(SendStatus.NotSent, ti)]
     # And again
     ti.completionCallback()
     assert self.successes == []
     assert self.failures == [(SendStatus.NotSent, ti)]
 def testTransmitIntentCallbackFailureFailedWithTarget(self):
     self.successes = []
     self.failures = []
     ti = TransmitIntent('addr', 'msg',
                         onSuccess = self._success,
                         onError = self._failed)
     ti.result = SendStatus.Failed
     # Ensure no exception thrown
     ti.completionCallback()
     assert self.successes == []
     assert self.failures == [(SendStatus.Failed, ti)]
     # And again
     ti.completionCallback()
     assert self.successes == []
     assert self.failures == [(SendStatus.Failed, ti)]
示例#11
0
 def testTransmitIntentCallbackFailureNotSentWithTarget(self):
     self.successes = []
     self.failures = []
     ti = TransmitIntent('addr',
                         'msg',
                         onSuccess=self._success,
                         onError=self._failed)
     ti.result = SendStatus.NotSent
     # Ensure no exception thrown
     ti.completionCallback()
     self.assertEqual(self.successes, [])
     self.assertEqual(self.failures, [(SendStatus.NotSent, ti)])
     # And again
     ti.completionCallback()
     self.assertEqual(self.successes, [])
     self.assertEqual(self.failures, [(SendStatus.NotSent, ti)])
 def testTransmitIntentCallbackSuccessWithChangedTargetsAdded(self):
     self.successes = []
     self.failures = []
     ti = TransmitIntent('addr', 'msg',
                         onSuccess = self._success,
                         onError = self._failed)
     ti.result = SendStatus.Sent
     # Ensure no exception thrown
     ti.completionCallback()
     assert self.successes == [(SendStatus.Sent, ti)]
     assert self.failures == []
     # And again
     ti.addCallback(self._success, self._failed)
     ti.completionCallback()
     assert self.successes == [(SendStatus.Sent, ti), (SendStatus.Sent, ti)]
     assert self.failures == []
示例#13
0
 def testTransmitIntentCallbackFailureFailedWithChangedTargetsAdded(self):
     self.successes = []
     self.failures = []
     ti = TransmitIntent('addr', 'msg',
                         onSuccess = self._success,
                         onError = self._failed)
     ti.result = SendStatus.Failed
     # Ensure no exception thrown
     ti.completionCallback()
     assert self.successes == []
     assert self.failures == [(SendStatus.Failed, ti)]
     # And again
     ti.addCallback(self._success, self._failed)
     ti.completionCallback()
     assert self.successes == []
     assert self.failures == [(SendStatus.Failed, ti),
                              (SendStatus.Failed, ti)]
示例#14
0
 def testTransmitIntentCallbackFailureFailedWithChangedTargetsAdded(self):
     self.successes = []
     self.failures = []
     ti = TransmitIntent('addr',
                         'msg',
                         onSuccess=self._success,
                         onError=self._failed)
     ti.result = SendStatus.Failed
     # Ensure no exception thrown
     ti.completionCallback()
     self.assertEqual(self.successes, [])
     self.assertEqual(self.failures, [(SendStatus.Failed, ti)])
     # And again
     ti.addCallback(self._success, self._failed)
     ti.completionCallback()
     self.assertEqual(self.successes, [])
     self.assertEqual(self.failures, [(SendStatus.Failed, ti),
                                      (SendStatus.Failed, ti)])