def test_receiver_exception(self): client = SMPPClientReceiver(self.config, self.barf) bindDeferred = client.connectAndBind().addCallback(self.do_test_setup) return defer.DeferredList([ bindDeferred, self.disconnectDeferred.addCallback(self.verify), ])
def test_receiver_bad_resp_param(self): client = SMPPClientReceiver(self.config, self.respondBadParam) bindDeferred = client.connectAndBind().addCallback(self.do_test_setup) return defer.DeferredList([ bindDeferred, self.disconnectDeferred.addCallback(self.verify), ])
def test_receiver_lifecycle(self): client = SMPPClientReceiver(self.config, lambda smpp, pdu: None) bindDeferred = client.connectAndBind().addCallback(self.do_test_setup) return defer.DeferredList([ bindDeferred, self.disconnectDeferred.addCallback(self.verify), ])
def test_outbind(self): client = SMPPClientReceiver(self.config, self.msgHandler) connectDeferred = client.connect() return defer.DeferredList([ connectDeferred, self.disconnectDeferred, ])
def test_receiver_lifecycle(self): client = SMPPClientReceiver(self.config, lambda smpp, pdu: None) smpp = yield client.connectAndBind() smpp.PDUReceived = mock.Mock(wraps=smpp.PDUReceived) smpp.sendPDU = mock.Mock(wraps=smpp.sendPDU) yield smpp.getDisconnectedDeferred() self.assertEquals(2, smpp.PDUReceived.call_count) self.assertEquals(2, smpp.sendPDU.call_count) recv1 = smpp.PDUReceived.call_args_list[0][0][0] recv2 = smpp.PDUReceived.call_args_list[1][0][0] sent1 = smpp.sendPDU.call_args_list[0][0][0] sent2 = smpp.sendPDU.call_args_list[1][0][0] self.assertTrue(isinstance(recv1, DeliverSM)) self.assertEquals(recv1.requireAck(recv1.seqNum), sent1) self.assertTrue(isinstance(recv2, Unbind)) self.assertEquals(recv2.requireAck(recv2.seqNum), sent2)
def test_receiver_bad_resp_param(self): client = SMPPClientReceiver(self.config, self.respondBadParam) smpp = yield client.connectAndBind() smpp.PDUReceived = mock.Mock(wraps=smpp.PDUReceived) smpp.sendPDU = mock.Mock(wraps=smpp.sendPDU) yield smpp.getDisconnectedDeferred() self.assertEquals(2, smpp.PDUReceived.call_count) self.assertEquals(2, smpp.sendPDU.call_count) recv1 = smpp.PDUReceived.call_args_list[0][0][0] recv2 = smpp.PDUReceived.call_args_list[1][0][0] sent1 = smpp.sendPDU.call_args_list[0][0][0] sent2 = smpp.sendPDU.call_args_list[1][0][0] self.assertTrue(isinstance(recv1, DeliverSM)) self.assertEquals(recv1.requireAck(recv1.seqNum, CommandStatus.ESME_RX_T_APPN), sent1) self.assertTrue(isinstance(sent2, Unbind)) self.assertTrue(isinstance(recv2, UnbindResp))
def test_receiver_bad_resp_param(self): client = SMPPClientReceiver(self.config, self.respondBadParam) smpp = yield client.connectAndBind() smpp.PDUReceived = mock.Mock(wraps=smpp.PDUReceived) smpp.sendPDU = mock.Mock(wraps=smpp.sendPDU) yield smpp.getDisconnectedDeferred() self.assertEquals(2, smpp.PDUReceived.call_count) self.assertEquals(2, smpp.sendPDU.call_count) recv1 = smpp.PDUReceived.call_args_list[0][0][0] recv2 = smpp.PDUReceived.call_args_list[1][0][0] sent1 = smpp.sendPDU.call_args_list[0][0][0] sent2 = smpp.sendPDU.call_args_list[1][0][0] self.assertTrue(isinstance(recv1, DeliverSM)) self.assertEquals( recv1.requireAck(recv1.seqNum, CommandStatus.ESME_RX_T_APPN), sent1) self.assertTrue(isinstance(sent2, Unbind)) self.assertTrue(isinstance(recv2, UnbindResp))
def test_bind_receiver_timeout(self): client = SMPPClientReceiver(self.config, lambda smpp, pdu: None) return self.assertFailure(client.connectAndBind(), SMPPSessionInitTimoutError)
def test_outbind(self): client = SMPPClientReceiver(self.config, self.msgHandler) smpp = yield client.connect() yield smpp.getDisconnectedDeferred()
def test_receiver_exception(self): client = SMPPClientReceiver(self.config, lambda smpp, pdu: None) bindDeferred = client.connectAndBind() return self.assertFailure(bindDeferred, SessionStateError)