예제 #1
0
    def test_handle_response_bad_frame(self):
        transport = FAsyncTransport()

        with self.assertRaises(TProtocolException) as cm:
            yield transport.handle_response(b"foo")

        self.assertEquals("Invalid frame size: 3", str(cm.exception))
예제 #2
0
 def test_handle_response_none(self):
     transport = FAsyncTransport()
     ctx = FContext()
     future = Future()
     transport._futures[str(ctx._get_op_id())] = future
     yield transport.handle_response(None)
     self.assertFalse(future.done())
예제 #3
0
 def test_handle_response_unregistered_op_id(self):
     transport = FAsyncTransport()
     ctx1 = FContext()
     ctx2 = FContext()
     future = Future()
     transport._futures[str(ctx1._get_op_id())] = future
     yield transport.handle_response(utils.mock_frame(ctx2))
     self.assertFalse(future.done())
예제 #4
0
    def test_handle_response_missing_op_id(self):
        transport = FAsyncTransport()
        frame = bytearray(b'\x00\x00\x00\x00\x00\x80\x01\x00\x02\x00\x00\x00'
                          b'\x08basePing\x00\x00\x00\x00\x00')

        with self.assertRaises(TProtocolException) as cm:
            yield transport.handle_response(frame)

        self.assertEquals("Frame missing op_id", str(cm.exception))
예제 #5
0
    def setUp(self):
        self.transport = FAsyncTransport()

        super(TestFAsyncTransport, self).setUp()
예제 #6
0
 def test_flush_not_implemented(self):
     transport = FAsyncTransport()
     with self.assertRaises(NotImplementedError):
         yield transport.flush(None)