From 5ce7e5c08201275f2a8f57f3239fa3bbb8ace993 Mon Sep 17 00:00:00 2001 From: cage Date: Fri, 13 Jan 2023 14:59:36 +0100 Subject: [PATCH] - [JSON-RPC] fixed tests (the error object returns the field 'data' now). --- src/tests/json-rpc2-tests.lisp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/tests/json-rpc2-tests.lisp b/src/tests/json-rpc2-tests.lisp index 0c4227e..e570c82 100644 --- a/src/tests/json-rpc2-tests.lisp +++ b/src/tests/json-rpc2-tests.lisp @@ -95,7 +95,7 @@ "{\"jsonrpc\":\"2.0\",\"method\":\"foobar\",\"id\":1}" (strcat "{\"jsonrpc\":\"2.0\"," "\"error\":{\"code\":-32601," - "\"message\":\"Method not found: \\\"foobar\\\"\"},\"id\":1}"))) + "\"message\":\"Method not found: \\\"foobar\\\"\",\"data\":null},\"id\":1}"))) (deftest test-invalid-json (json-rpc2-suite) (let* ((json-req "{\"jsonrpc\": \"2.0\", \"method\": \"foobar, \"params\": \"bar\", \"baz]") @@ -103,7 +103,7 @@ (assert-true (string= json-resp (strcat "{\"jsonrpc\":\"2.0\",\"error\":{\"code\":-32700," - "\"message\":\"Parse error\"},\"id\":null}"))))) + "\"message\":\"Parse error\",\"data\":null},\"id\":null}"))))) (deftest test-invalid-request (json-rpc2-suite) (let* ((json-req "{\"jsonrpc\": \"2.0\", \"method\": 1, \"params\": \"bar\"}") @@ -111,7 +111,7 @@ (assert-true (string= json-resp (strcat "{\"jsonrpc\":\"2.0\",\"error\":" - "{\"code\":-32600,\"message\":\"Invalid Request\"},\"id\":null}"))))) + "{\"code\":-32600,\"message\":\"Invalid Request\",\"data\":null},\"id\":null}"))))) (deftest test-batch (json-rpc2-suite) (prepare-rpc @@ -124,7 +124,7 @@ (expected (strcat "[" "{\"jsonrpc\":\"2.0\",\"result\":30,\"id\":2}," "{\"jsonrpc\":\"2.0\",\"error\":{\"code\":-32601," - "\"message\":\"Method not found: \\\"foo\\\"\"},\"id\":1}," + "\"message\":\"Method not found: \\\"foo\\\"\",\"data\":null},\"id\":1}," "{\"jsonrpc\":\"2.0\",\"result\":3,\"id\":1}" "]"))) (assert-equality #'string= @@ -141,7 +141,7 @@ (assert-true (string= json-resp (strcat "{\"jsonrpc\":\"2.0\",\"error\":" - "{\"code\":-32700,\"message\":\"Parse error\"},\"id\":null}"))))) + "{\"code\":-32700,\"message\":\"Parse error\",\"data\":null},\"id\":null}"))))) (deftest test-batch-empty-array (json-rpc2-suite) (let* ((json-req "[]") @@ -149,7 +149,7 @@ (assert-true (string= json-resp (strcat "{\"jsonrpc\":\"2.0\",\"error\":" - "{\"code\":-32600,\"message\":\"Invalid Request\"},\"id\":null}"))))) + "{\"code\":-32600,\"message\":\"Invalid Request\",\"data\":null},\"id\":null}"))))) (deftest test-batch-invalid (json-rpc2-suite) (let* ((json-req "[1]") @@ -158,7 +158,7 @@ (string= json-resp (strcat "[" "{\"jsonrpc\":\"2.0\",\"error\":" - "{\"code\":-32600,\"message\":\"Invalid Request\"},\"id\":null}" + "{\"code\":-32600,\"message\":\"Invalid Request\",\"data\":null},\"id\":null}" "]"))))) (deftest test-batch-invalid-2 (json-rpc2-suite) @@ -168,11 +168,11 @@ (string= json-resp (strcat "[" "{\"jsonrpc\":\"2.0\",\"error\":" - "{\"code\":-32600,\"message\":\"Invalid Request\"},\"id\":null}," + "{\"code\":-32600,\"message\":\"Invalid Request\",\"data\":null},\"id\":null}," "{\"jsonrpc\":\"2.0\",\"error\":" - "{\"code\":-32600,\"message\":\"Invalid Request\"},\"id\":null}," + "{\"code\":-32600,\"message\":\"Invalid Request\",\"data\":null},\"id\":null}," "{\"jsonrpc\":\"2.0\",\"error\":{\"code\":" - "-32600,\"message\":\"Invalid Request\"},\"id\":null}" + "-32600,\"message\":\"Invalid Request\",\"data\":null},\"id\":null}" "]"))))) (deftest test-batch-notification (json-rpc2-suite)