def test_cleanupConnectionNotImmediately(self): """ L{_NewConnectionHelper.cleanupConnection} closes the transport cleanly if called with C{immediate} set to C{False}. """ helper = _NewConnectionHelper( None, None, None, None, None, None, None, None, None, None) connection = SSHConnection() connection.transport = StringTransport() helper.cleanupConnection(connection, False) self.assertTrue(connection.transport.disconnecting)
def test_cleanupConnectionNotImmediately(self): """ L{_NewConnectionHelper.cleanupConnection} closes the transport cleanly if called with C{immediate} set to C{False}. """ helper = _NewConnectionHelper(None, None, None, None, None, None, None, None, None, None) connection = SSHConnection() connection.transport = StringTransport() helper.cleanupConnection(connection, False) self.assertTrue(connection.transport.disconnecting)
def test_cleanupConnectionImmediately(self): """ L{_NewConnectionHelper.cleanupConnection} closes the transport with C{abortConnection} if called with C{immediate} set to C{True}. """ class Abortable: aborted = False def abortConnection(self): """ Abort the connection. """ self.aborted = True helper = _NewConnectionHelper( None, None, None, None, None, None, None, None, None, None) connection = SSHConnection() connection.transport = SSHClientTransport() connection.transport.transport = Abortable() helper.cleanupConnection(connection, True) self.assertTrue(connection.transport.transport.aborted)
def test_cleanupConnectionImmediately(self): """ L{_NewConnectionHelper.cleanupConnection} closes the transport with C{abortConnection} if called with C{immediate} set to C{True}. """ class Abortable: aborted = False def abortConnection(self): """ Abort the connection. """ self.aborted = True helper = _NewConnectionHelper(None, None, None, None, None, None, None, None, None, None) connection = SSHConnection() connection.transport = SSHClientTransport() connection.transport.transport = Abortable() helper.cleanupConnection(connection, True) self.assertTrue(connection.transport.transport.aborted)