Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/test/server_tests.cpp
// Copyright (c) 2019 The Bitcoin developers | // Copyright (c) 2019 The Bitcoin developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <rpc/server.h> | #include <rpc/server.h> | ||||
#include <test/test_bitcoin.h> | #include <test/test_bitcoin.h> | ||||
#include <util.h> | #include <util.h> | ||||
#include <boost/test/unit_test.hpp> | |||||
#include <cstdint> | #include <cstdint> | ||||
#include <vector> | #include <vector> | ||||
#include <boost/test/unit_test.hpp> | |||||
BOOST_FIXTURE_TEST_SUITE(server_tests, BasicTestingSetup) | BOOST_FIXTURE_TEST_SUITE(server_tests, BasicTestingSetup) | ||||
BOOST_AUTO_TEST_CASE(server_IsDeprecatedRPCEnabled) { | BOOST_AUTO_TEST_CASE(server_IsDeprecatedRPCEnabled) { | ||||
ArgsManager testArgs; | ArgsManager testArgs; | ||||
testArgs.AddArg("-deprecatedrpc", "", false, OptionsCategory::OPTIONS); | |||||
const char *argv_test[] = {"bitcoind", "-deprecatedrpc=foo", | const char *argv_test[] = {"bitcoind", "-deprecatedrpc=foo", | ||||
"-deprecatedrpc=bar"}; | "-deprecatedrpc=bar"}; | ||||
testArgs.ParseParameters(3, (char **)argv_test); | std::string error; | ||||
BOOST_CHECK_MESSAGE(testArgs.ParseParameters(3, (char **)argv_test, error), | |||||
error); | |||||
BOOST_CHECK(IsDeprecatedRPCEnabled(testArgs, "foo") == true); | BOOST_CHECK(IsDeprecatedRPCEnabled(testArgs, "foo") == true); | ||||
BOOST_CHECK(IsDeprecatedRPCEnabled(testArgs, "bar") == true); | BOOST_CHECK(IsDeprecatedRPCEnabled(testArgs, "bar") == true); | ||||
BOOST_CHECK(IsDeprecatedRPCEnabled(testArgs, "bob") == false); | BOOST_CHECK(IsDeprecatedRPCEnabled(testArgs, "bob") == false); | ||||
} | } | ||||
BOOST_AUTO_TEST_SUITE_END() | BOOST_AUTO_TEST_SUITE_END() |