Example #1
0
 def test_generic_nack_no_seq_num(self):
     client = SMPPClientTransceiver(self.config, lambda smpp, pdu: None)
     bindDeferred = client.connectAndBind().addCallback(self.do_test_setup)
     return defer.DeferredList([
         bindDeferred,
         self.assertFailure(self.submitSMDeferred, SMPPClientConnectionCorruptedError),
         self.disconnectDeferred.addCallback(self.verify),
     ])
Example #2
0
 def test_error_on_submit(self):
     client = SMPPClientTransceiver(self.config, lambda smpp, pdu: None)
     bindDeferred = client.connectAndBind().addCallback(self.do_test_setup)
     return defer.DeferredList([
         bindDeferred,
         self.disconnectDeferred,
         self.assertFailure(self.submitSMDeferred, SMPPTransactionError),
     ])
Example #3
0
 def test_error_on_submit(self):
     client = SMPPClientTransceiver(self.config, lambda smpp, pdu: None)
     bindDeferred = client.connectAndBind().addCallback(self.do_test_setup)
     return defer.DeferredList([
         bindDeferred,
         self.disconnectDeferred,
         self.assertFailure(self.submitSMDeferred, SMPPTransactionError),
     ])
Example #4
0
 def test_generic_nack_no_seq_num(self):
     client = SMPPClientTransceiver(self.config, lambda smpp, pdu: None)
     bindDeferred = client.connectAndBind().addCallback(self.do_test_setup)
     return defer.DeferredList([
         bindDeferred,
         self.assertFailure(self.submitSMDeferred,
                            SMPPClientConnectionCorruptedError),
         self.disconnectDeferred.addCallback(self.verify),
     ])
 def test_error_on_submit(self):
     client = SMPPClientTransceiver(self.config, lambda smpp, pdu: None)
     smpp = yield client.connectAndBind()
     try:
         yield smpp.sendDataRequest(SubmitSM())
     except SMPPTransactionError:
         pass
     else:
         self.assertTrue(False, "SMPPTransactionError not raised")
     finally:
         yield smpp.unbindAndDisconnect()
Example #6
0
 def test_error_on_submit(self):
     client = SMPPClientTransceiver(self.config, lambda smpp, pdu: None)
     smpp = yield client.connectAndBind()
     try:
         yield smpp.sendDataRequest(SubmitSM())
     except SMPPTransactionError:
         pass
     else:
         self.assertTrue(False, "SMPPTransactionError not raised")
     finally:
         yield smpp.unbindAndDisconnect()
 def test_nack_on_invalid_msg(self):
     client = SMPPClientTransceiver(self.config, lambda smpp, pdu: None)
     smpp = yield client.connectAndBind()
     
     msgSentDeferred = defer.Deferred()
     
     smpp.sendPDU = mock.Mock()
     smpp.sendPDU.side_effect = functools.partial(self.mock_side_effect, msgSentDeferred)
     
     yield msgSentDeferred
     
     yield smpp.disconnect()
     
     self.assertEquals(1, smpp.sendPDU.call_count)
     smpp.sendPDU.assert_called_with(QuerySMResp(seqNum=self.protocol.seqNum, status=CommandStatus.ESME_RINVSRCTON))
 def test_generic_nack_no_seq_num(self):
     client = SMPPClientTransceiver(self.config, lambda smpp, pdu: None)
     smpp = yield client.connectAndBind()
     
     try:
         submitDeferred = smpp.sendDataRequest(SubmitSM())
         smpp.sendPDU = mock.Mock(wraps=smpp.sendPDU)
         yield submitDeferred
     except SMPPClientConnectionCorruptedError:
         pass
     else:
         self.assertTrue(False, "SMPPClientConnectionCorruptedError not raised")
         
     #for nack with no seq num, the connection is corrupt so don't unbind()
     self.assertEquals(0, smpp.sendPDU.call_count)      
 def test_generic_nack_on_invalid_cmd_id(self):
     client = SMPPClientTransceiver(self.config, lambda smpp, pdu: None)
     smpp = yield client.connectAndBind()
     
     msgSentDeferred = defer.Deferred()
     
     smpp.sendPDU = mock.Mock()
     smpp.sendPDU.side_effect = functools.partial(self.mock_side_effect, msgSentDeferred)
     
     yield msgSentDeferred
     
     yield smpp.disconnect()
     
     self.assertEquals(1, smpp.sendPDU.call_count)
     smpp.sendPDU.assert_called_with(GenericNack(status=CommandStatus.ESME_RINVCMDID))
Example #10
0
    def test_generic_nack_no_seq_num(self):
        client = SMPPClientTransceiver(self.config, lambda smpp, pdu: None)
        smpp = yield client.connectAndBind()

        try:
            submitDeferred = smpp.sendDataRequest(SubmitSM())
            smpp.sendPDU = mock.Mock(wraps=smpp.sendPDU)
            yield submitDeferred
        except SMPPClientConnectionCorruptedError:
            pass
        else:
            self.assertTrue(False,
                            "SMPPClientConnectionCorruptedError not raised")

        #for nack with no seq num, the connection is corrupt so don't unbind()
        self.assertEquals(0, smpp.sendPDU.call_count)
Example #11
0
 def run(self):
     try:
         #Bind
         smpp = yield SMPPClientTransceiver(self.config, self.handleMsg).connectAndBind()
         #Wait for disconnect
         yield smpp.getDisconnectedDeferred()
     except Exception, e:
         print "ERROR: %s" % str(e)
Example #12
0
    def test_generic_nack_on_invalid_cmd_id(self):
        client = SMPPClientTransceiver(self.config, lambda smpp, pdu: None)
        smpp = yield client.connectAndBind()

        msgSentDeferred = defer.Deferred()

        smpp.sendPDU = mock.Mock()
        smpp.sendPDU.side_effect = functools.partial(self.mock_side_effect,
                                                     msgSentDeferred)

        yield msgSentDeferred

        yield smpp.disconnect()

        self.assertEquals(1, smpp.sendPDU.call_count)
        smpp.sendPDU.assert_called_with(
            GenericNack(status=CommandStatus.ESME_RINVCMDID))
Example #13
0
    def test_nack_on_invalid_msg(self):
        client = SMPPClientTransceiver(self.config, lambda smpp, pdu: None)
        smpp = yield client.connectAndBind()

        msgSentDeferred = defer.Deferred()

        smpp.sendPDU = mock.Mock()
        smpp.sendPDU.side_effect = functools.partial(self.mock_side_effect,
                                                     msgSentDeferred)

        yield msgSentDeferred

        yield smpp.disconnect()

        self.assertEquals(1, smpp.sendPDU.call_count)
        smpp.sendPDU.assert_called_with(
            QuerySMResp(seqNum=self.protocol.seqNum,
                        status=CommandStatus.ESME_RINVSRCTON))
Example #14
0
 def run(self):
     try:
         self.smpp = yield SMPPClientTransceiver(self.smpp_config, self.handleMsg).connectAndBind()
         self.lc_send_all = task.LoopingCall(self.send_all)
         self.lc_send_all.start(3)
         yield self.smpp.getDisconnectedDeferred()
     except Exception, e:
         self.logger.critical(e)
         raise
 def test_bind_transceiver_timeout(self):
     client = SMPPClientTransceiver(self.config, lambda smpp, pdu: None)
     return self.assertFailure(client.connectAndBind(), SMPPSessionInitTimoutError)
Example #16
0
 def test_bind_transceiver_timeout(self):
     client = SMPPClientTransceiver(self.config, lambda smpp, pdu: None)
     return self.assertFailure(client.connectAndBind(),
                               SMPPSessionInitTimoutError)
Example #17
0
 def test_nack_on_invalid_msg(self):
     client = SMPPClientTransceiver(self.config, lambda smpp, pdu: None)
     bindDeferred = client.connectAndBind().addCallback(self.mock_sendPDU)
     return self.msgSentDeferred.addCallback(self.verifyNackSent)
Example #18
0
 def test_nack_on_invalid_msg(self):
     client = SMPPClientTransceiver(self.config, lambda smpp, pdu: None)
     bindDeferred = client.connectAndBind().addCallback(self.mock_sendPDU)
     return self.msgSentDeferred.addCallback(self.verifyNackSent)