def test_reconnect_on_authentication_failure(self): client = SMPPClientFactory(self.config) client.reConnect = mock.Mock(wraps=client.reConnect) # Connect and bind yield client.connectAndBind() smpp = client.smpp reactor.callLater(5, client.disconnectAndDontRetryToConnect) # Normally, the client shall not exit since it should retry to connect # Triggering the exitDeferred callback is a way to continue this test reactor.callLater(6, client.exitDeferred.callback, None) yield client.getExitDeferred() ############## # Assertions : # Protocol verification self.assertNotEqual(0, client.reConnect.call_count)
def test_reconnect_on_authentication_failure(self): client = SMPPClientFactory(self.config) client.reConnect = mock.Mock(wraps=client.reConnect) # Connect and bind yield client.connectAndBind() smpp = client.smpp reactor.callLater(5, client.disconnectAndDontRetryToConnect) # Normally, the client shall not exit since it should retry to connect # Triggering the exitDeferred callback is a way to continue this test reactor.callLater(6, client.exitDeferred.callback, None) yield client.getExitDeferred() ############## # Assertions : # Protocol verification self.assertNotEqual(0, client.reConnect.call_count)
def test_reconnect_on_connection_failure(self): client = SMPPClientFactory(self.config) client.reConnect = mock.Mock(wraps=client.reConnect) # Connect and bind yield client.connectAndBind() smpp = client.smpp smpp.PDUReceived = mock.Mock(wraps=smpp.PDUReceived) smpp.sendPDU = mock.Mock(wraps=smpp.sendPDU) # Unbind & Disconnect yield client.disconnect() ############## # Assertions : # Protocol verification self.assertEquals(1, smpp.PDUReceived.call_count) self.assertEquals(1, smpp.sendPDU.call_count) self.assertNotEqual(0, client.reConnect.call_count)
def test_reconnect_on_connection_failure(self): client = SMPPClientFactory(self.config) client.reConnect = mock.Mock(wraps=client.reConnect) # Connect and bind yield client.connectAndBind() smpp = client.smpp smpp.PDUReceived = mock.Mock(wraps=smpp.PDUReceived) smpp.sendPDU = mock.Mock(wraps=smpp.sendPDU) # Unbind & Disconnect yield client.disconnect() ############## # Assertions : # Protocol verification self.assertEquals(1, smpp.PDUReceived.call_count) self.assertEquals(1, smpp.sendPDU.call_count) self.assertNotEqual(0, client.reConnect.call_count)