示例#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))
示例#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))
示例#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)
示例#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)
示例#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)
示例#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)
示例#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)
示例#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)
示例#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])
示例#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))
示例#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])
示例#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))