def test_secureConnection(self): """ L{_ExistingConnectionHelper.secureConnection} returns a L{Deferred} which fires with whatever object was fed to L{_ExistingConnectionHelper.__init__}. """ result = object() helper = _ExistingConnectionHelper(result) self.assertIs(result, self.successResultOf(helper.secureConnection()))
def test_cleanupConnectionImmediately(self): """ L{_ExistingConnectionHelper.cleanupConnection} does nothing to the existing connection if called with C{immediate} set to C{True}. """ helper = _ExistingConnectionHelper(object()) # Bit hard to test nothing happens. However, since object() has no # relevant methods or attributes, if the code is incorrect we can # expect an AttributeError. helper.cleanupConnection(object(), True)
def test_secureConnection(self): """ L{_ExistingConnectionHelper.secureConnection} returns a L{Deferred} which fires with whatever object was fed to L{_ExistingConnectionHelper.__init__}. """ result = object() helper = _ExistingConnectionHelper(result) self.assertIdentical( result, self.successResultOf(helper.secureConnection()))
def existingConnection(cls, connection): """Overload stock existinConnection to not require ``commands``.""" helper = _ExistingConnectionHelper(connection) return cls(helper)