def test_pool_with_framed_protocol_factory(self): def framed_protocol_factory(trans): trans = TTransport.TFramedTransport(trans) return TBinaryProtocol.TBinaryProtocol(trans) framed_pool = thrift_pool.ThriftConnectionPool(EXAMPLE_ENDPOINT, protocol_factory=framed_protocol_factory) trans = thrift_pool._make_transport(EXAMPLE_ENDPOINT) prot = framed_pool.protocol_factory(trans) self.assertTrue(isinstance(prot, TBinaryProtocol.TBinaryProtocol)) self.assertTrue(isinstance(prot.trans, TTransport.TFramedTransport))
def setUp(self): self.mock_queue = mock.Mock(spec=queue.Queue) self.pool = thrift_pool.ThriftConnectionPool(EXAMPLE_ENDPOINT) self.pool.pool = self.mock_queue