def test_maximum_message_size_exceeded(self): parser = JsonRpcParser() parser.max_message_size = 100 message = '{{ "{0}": "{1}" }}'.format('x' * 100, 'y' * 100) message = message.encode('ascii') exc = assert_raises(ParseError, parser.feed, message) assert exc.args[0] == errno.MESSAGE_TOO_LARGE
def test_maximum_message_size_exceeded(self): parser = JsonRpcParser() parser.max_message_size = 100 message = '{{ "{0}": "{1}" }}'.format('x' * 100, 'y' * 100) message = message.encode('ascii') exc = assert_raises(ParseError, parser.feed, message) assert exc.args[0] == errno.MESSAGE_TOO_LARGE
def test_call_method_error(self): server = JsonRpcServer(echo_app) server.listen(('127.0.0.1', 0)) addr = server.transport.getsockname() client = JsonRpcClient() client.connect(addr) exc = assert_raises(JsonRpcError, client.call_method, 'echo2') assert exc.args[0] == errno.INVALID_REQUEST
def test_call_method_error(self): server = JsonRpcServer(echo_app) server.listen(('127.0.0.1', 0)) addr = server.transport.getsockname() client = JsonRpcClient() client.connect(addr) exc = assert_raises(JsonRpcError, client.call_method, 'echo2') assert exc.args[0] == errno.INVALID_REQUEST
def test_illegal_jsonrpc(self): m = b'{ "xxxx": "yyyy" }' parser = JsonRpcParser() exc = assert_raises(ParseError, parser.feed, m) assert exc.args[0] == errno.PARSE_ERROR
def test_encoding_error(self): m = b'{ xxx\xff }' parser = JsonRpcParser() exc = assert_raises(ParseError, parser.feed, m) assert exc.args[0] == errno.PARSE_ERROR
def test_framing_error(self): m = b'xxx' parser = JsonRpcParser() exc = assert_raises(ParseError, parser.feed, m) assert exc.args[0] == errno.FRAMING_ERROR
def test_illegal_jsonrpc(self): m = b'{ "xxxx": "yyyy" }' parser = JsonRpcParser() exc = assert_raises(ParseError, parser.feed, m) assert exc.args[0] == errno.PARSE_ERROR
def test_encoding_error(self): m = b'{ xxx\xff }' parser = JsonRpcParser() exc = assert_raises(ParseError, parser.feed, m) assert exc.args[0] == errno.PARSE_ERROR
def test_framing_error(self): m = b'xxx' parser = JsonRpcParser() exc = assert_raises(ParseError, parser.feed, m) assert exc.args[0] == errno.FRAMING_ERROR
def test_maximum_message_size_exceeded(self): parser = DBusParser() parser.max_message_size = 100 m = b'l\1\0\1\0\1\0\0\1\0\0\0\0\0\0\0' + b'x' * 256 exc = assert_raises(ParseError, parser.feed, m) assert exc.args[0] == errno.MESSAGE_TOO_LARGE
def test_illegal_message(self): m = b'l\1\0\2\0\0\0\0\1\0\0\0\0\0\0\0' parser = DBusParser() exc = assert_raises(ParseError, parser.feed, m) assert exc.args[0] == errno.FRAMING_ERROR