Example #1
0
 async def send_request_bad(request):
     message, future = connection.send_request(request)
     await queue.put(message)
     try:
         await future
         assert False
     except Exception as e:
         assert_RPCError(e, JSONRPC.INVALID_REQUEST, "response too large")
Example #2
0
 async def send_message():
     nonlocal send_message
     send_message, event = connection.send_request(req)
     waiting.set()
     await event.wait()
     assert event.result == 6
     # Test receipt of an error response
     send_message, event = connection.send_request(req)
     waiting.set()
     await event.wait()
     assert_RPCError(event.result, JSONRPC.METHOD_NOT_FOUND,
                     "cannot add up")
     send_message, event = connection.send_request(req)
     waiting.set()
     await event.wait()
     # Test receipt of a protocol violation
     assert_ProtocolError(event.result, JSONRPC.INVALID_REQUEST, '"result"')
Example #3
0
 async def send_message():
     nonlocal send_message
     send_message, future = connection.send_request(req)
     waiting.set()
     assert await future == 6
     # Test receipt of an error response
     send_message, future = connection.send_request(req)
     waiting.set()
     try:
         await future
     except Exception as e:
         assert_RPCError(e, JSONRPC.METHOD_NOT_FOUND, "cannot add up")
     send_message, future = connection.send_request(req)
     waiting.set()
     try:
         await future
     except Exception as e:
         assert_ProtocolError(e, JSONRPC.INVALID_REQUEST, '"result"')
Example #4
0
 async def send_request_bad(request):
     message, event = connection.send_request(request)
     await queue.put(message)
     await event.wait()
     assert_RPCError(event.result, JSONRPC.INVALID_REQUEST,
                     "response too large")