def test_wrappingProtocolNotFileDescriptorReceiver(self): """ Our L{_WrappingProtocol} does not provide L{IHalfCloseableProtocol} if the wrapped protocol doesn't. """ tp = TestProtocol() p = endpoints._WrappingProtocol(None, tp) self.assertFalse(interfaces.IFileDescriptorReceiver.providedBy(p))
def test_wrappedProtocolWriteConnectionLost(self): """ L{_WrappingProtocol.writeConnectionLost} should proxy to the wrapped protocol's C{writeConnectionLost} """ hcp = TestHalfCloseableProtocol() p = endpoints._WrappingProtocol(None, hcp) p.writeConnectionLost() self.assertEqual(hcp.writeLost, True)
def test_wrappingProtocolNotHalfCloseable(self): """ Our L{_WrappingProtocol} should not provide L{IHalfCloseableProtocol} if the C{WrappedProtocol} doesn't. """ tp = TestProtocol() p = endpoints._WrappingProtocol(None, tp) self.assertEqual( interfaces.IHalfCloseableProtocol.providedBy(p), False)
def test_wrappingProtocolNotHalfCloseable(self): """ Our L{_WrappingProtocol} should not provide L{IHalfCloseableProtocol} if the C{WrappedProtocol} doesn't. """ tp = TestProtocol() p = endpoints._WrappingProtocol(None, tp) self.assertEqual(interfaces.IHalfCloseableProtocol.providedBy(p), False)
def test_wrappingProtocolHalfCloseable(self): """ Our L{_WrappingProtocol} should be an L{IHalfCloseableProtocol} if the C{wrappedProtocol} is. """ cd = object() hcp = TestHalfCloseableProtocol() p = endpoints._WrappingProtocol(cd, hcp) self.assertEqual(interfaces.IHalfCloseableProtocol.providedBy(p), True)
def test_wrappingProtocolHalfCloseable(self): """ Our L{_WrappingProtocol} should be an L{IHalfCloseableProtocol} if the C{wrappedProtocol} is. """ cd = object() hcp = TestHalfCloseableProtocol() p = endpoints._WrappingProtocol(cd, hcp) self.assertEqual( interfaces.IHalfCloseableProtocol.providedBy(p), True)
def test_wrappedProtocolFileDescriptorReceived(self): """ L{_WrappingProtocol.fileDescriptorReceived} calls the wrapped protocol's C{fileDescriptorReceived} method. """ wrappedProtocol = TestFileDescriptorReceiverProtocol() wrapper = endpoints._WrappingProtocol( defer.Deferred(), wrappedProtocol) wrapper.makeConnection(StringTransport()) wrapper.fileDescriptorReceived(42) self.assertEqual(wrappedProtocol.receivedDescriptors, [42])
def test_wrappingProtocolFileDescriptorReceiver(self): """ Our L{_WrappingProtocol} should be an L{IFileDescriptorReceiver} if the wrapped protocol is. """ connectedDeferred = None applicationProtocol = TestFileDescriptorReceiverProtocol() wrapper = endpoints._WrappingProtocol( connectedDeferred, applicationProtocol) self.assertTrue(interfaces.IFileDescriptorReceiver.providedBy(wrapper)) self.assertTrue(verifyObject(interfaces.IFileDescriptorReceiver, wrapper))
def test_wrappedProtocolFileDescriptorReceived(self): """ L{_WrappingProtocol.fileDescriptorReceived} calls the wrapped protocol's C{fileDescriptorReceived} method. """ wrappedProtocol = TestFileDescriptorReceiverProtocol() wrapper = endpoints._WrappingProtocol(defer.Deferred(), wrappedProtocol) wrapper.makeConnection(StringTransport()) wrapper.fileDescriptorReceived(42) self.assertEqual(wrappedProtocol.receivedDescriptors, [42])
def test_wrappingProtocolFileDescriptorReceiver(self): """ Our L{_WrappingProtocol} should be an L{IFileDescriptorReceiver} if the wrapped protocol is. """ connectedDeferred = None applicationProtocol = TestFileDescriptorReceiverProtocol() wrapper = endpoints._WrappingProtocol(connectedDeferred, applicationProtocol) self.assertTrue(interfaces.IFileDescriptorReceiver.providedBy(wrapper)) self.assertTrue( verifyObject(interfaces.IFileDescriptorReceiver, wrapper))