Beispiel #1
0
 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))
Beispiel #2
0
 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))
Beispiel #3
0
 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)
Beispiel #4
0
 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)
Beispiel #5
0
 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)
Beispiel #6
0
 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)
Beispiel #7
0
 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)
Beispiel #8
0
 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)
Beispiel #9
0
 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])
Beispiel #10
0
 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))
Beispiel #11
0
 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])
Beispiel #12
0
 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))