From 2831ed053825eaead84aaaee39bab9e6fa1f7783 Mon Sep 17 00:00:00 2001 From: Scott Schurr Date: Mon, 13 Jan 2020 13:03:40 -0800 Subject: [PATCH] Add unittests for peer_reservations command line interface --- src/test/rpc/RPCCall_test.cpp | 131 ++++++++++++++++++++++++++++++++++ 1 file changed, 131 insertions(+) diff --git a/src/test/rpc/RPCCall_test.cpp b/src/test/rpc/RPCCall_test.cpp index e497a3b89..f2ca37582 100644 --- a/src/test/rpc/RPCCall_test.cpp +++ b/src/test/rpc/RPCCall_test.cpp @@ -5187,6 +5187,137 @@ static RPCCallTestData const rpcCallTestArray [] = })" }, +// peer_reservations_add ------------------------------------------------------- +{ + "peer_reservations_add: minimal.", __LINE__, + { + "peer_reservations_add", + "public_key_string" + }, + RPCCallTestData::no_exception, + R"({ + "method" : "peer_reservations_add", + "params" : [ + { + "api_version" : %MAX_API_VER%, + "public_key" : "public_key_string" + } + ] + })" +}, +{ + "peer_reservations_add: with description.", __LINE__, + { + "peer_reservations_add", + "public_key_string", + "public_key_description" + }, + RPCCallTestData::no_exception, + R"({ + "method" : "peer_reservations_add", + "params" : [ + { + "api_version" : %MAX_API_VER%, + "description" : "public_key_description", + "public_key" : "public_key_string" + } + ] + })" +}, +{ + "peer_reservations_add: too few arguments.", __LINE__, + { + "peer_reservations_add" + }, + RPCCallTestData::no_exception, + R"({ + "method" : "peer_reservations_add", + "params" : [ + { + "error" : "badSyntax", + "error_code" : 1, + "error_message" : "Syntax error." + } + ] + })" +}, +{ + "peer_reservations_add: too many arguments.", __LINE__, + { + "peer_reservations_add", + "public_key_string", + "public_key_description", + "spare" + }, + RPCCallTestData::no_exception, + R"({ + "method" : "peer_reservations_add", + "params" : [ + { + "error" : "badSyntax", + "error_code" : 1, + "error_message" : "Syntax error." + } + ] + })" +}, + +// peer_reservations_del ------------------------------------------------------- +{ + "peer_reservations_del: minimal.", __LINE__, + { + "peer_reservations_del", + "public_key_string" + }, + RPCCallTestData::no_exception, + R"({ + "method" : "peer_reservations_del", + "params" : [ + { + "api_version" : %MAX_API_VER%, + "public_key" : "public_key_string" + } + ] + })" +}, +{ + "peer_reservations_del: too few arguments.", __LINE__, + { + "peer_reservations_del" + }, + RPCCallTestData::no_exception, + R"({ + "method" : "peer_reservations_del", + "params" : [ + { + "error" : "badSyntax", + "error_code" : 1, + "error_message" : "Syntax error." + } + ] + })" +}, +{ + "peer_reservations_del: too many arguments.", __LINE__, + { + "peer_reservations_del", + "public_key_string", + "public_key_description", + "spare" + }, + RPCCallTestData::no_exception, + R"({ + "method" : "peer_reservations_del", + "params" : [ + { + "error" : "badSyntax", + "error_code" : 1, + "error_message" : "Syntax error." + } + ] + })" +}, + // ping ------------------------------------------------------------------------ { "ping: minimal.", __LINE__,