def test_request_context_send_error(self):
    queue = Queue()
    in_message = JSONRPCMessage.from_dictionary({'id': '123', 'method': 'test/text/', 'params': {}})
    rc = RequestContext(in_message, queue)
    params = {}
    rc.send_error(params)
    self.assertTrue(queue.not_empty)
    out_message = queue.get_nowait()
    self.assertIsInstance(out_message, JSONRPCMessage)
    self.assertEqual(out_message.message_type, JSONRPCMessageType.ResponseError)
    self.assertEqual(out_message.message_id, '123')
    self.assertIsInstance(out_message.message_error, dict)
    self.assertIs(out_message.message_error['message'], params)
def test_request_context_send_error(self):
    queue = Queue()
    in_message = JSONRPCMessage.from_dictionary({'id': '123', 'method': 'test/text/', 'params': {}})
    rc = RequestContext(in_message, queue)
    params = {}
    rc.send_error(params)
    self.assertTrue(queue.not_empty)
    out_message = queue.get_nowait()
    self.assertIsInstance(out_message, JSONRPCMessage)
    self.assertEqual(out_message.message_type, JSONRPCMessageType.ResponseError)
    self.assertEqual(out_message.message_id, '123')
    self.assertIsInstance(out_message.message_error, dict)
    self.assertIs(out_message.message_error['message'], params)