def test_connectionFailedDoesntCallLoseConnection(self): """ L{ConnectedDatagramPort} does not call the deprecated C{loseConnection} in L{ConnectedDatagramPort.connectionFailed}. """ def loseConnection(): """ Dummy C{loseConnection} method. C{loseConnection} is deprecated and should not get called. """ self.fail( "loseConnection is deprecated and should not get called.") port = unix.ConnectedDatagramPort(None, ClientProto()) port.loseConnection = loseConnection port.connectionFailed("goodbye")
def test_connectionFailedCallsStopListening(self): """ L{ConnectedDatagramPort} calls L{ConnectedDatagramPort.stopListening} instead of the deprecated C{loseConnection} in L{ConnectedDatagramPort.connectionFailed}. """ self.called = False def stopListening(): """ Dummy C{stopListening} method. """ self.called = True port = unix.ConnectedDatagramPort(None, ClientProto()) port.stopListening = stopListening port.connectionFailed("goodbye") self.assertTrue(self.called)