Bitcoin ABC 0.30.7
P2P Digital Currency
server_tests.cpp
Go to the documentation of this file.
1// Copyright (c) 2019 The Bitcoin developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5#include <common/system.h>
6#include <rpc/server.h>
7#include <test/util/setup_common.h>
8
9#include <boost/test/unit_test.hpp>
10
11#include <cstdint>
12#include <vector>
13
14BOOST_FIXTURE_TEST_SUITE(server_tests, BasicTestingSetup)
15
16BOOST_AUTO_TEST_CASE(server_IsDeprecatedRPCEnabled) {
17 ArgsManager testArgs;
18 testArgs.AddArg("-deprecatedrpc", "", ArgsManager::ALLOW_ANY,
20
21 const char *argv_test[] = {"bitcoind", "-deprecatedrpc=foo",
22 "-deprecatedrpc=bar"};
23
24 std::string error;
25 BOOST_CHECK_MESSAGE(testArgs.ParseParameters(3, (char **)argv_test, error),
26 error);
27
28 BOOST_CHECK(IsDeprecatedRPCEnabled(testArgs, "foo") == true);
29 BOOST_CHECK(IsDeprecatedRPCEnabled(testArgs, "bar") == true);
30 BOOST_CHECK(IsDeprecatedRPCEnabled(testArgs, "bob") == false);
31}
32
33BOOST_AUTO_TEST_SUITE_END()
@ ALLOW_ANY
Definition: args.h:103
bool ParseParameters(int argc, const char *const argv[], std::string &error)
Definition: args.cpp:201
void AddArg(const std::string &name, const std::string &help, unsigned int flags, const OptionsCategory &cat)
Add argument.
Definition: args.cpp:620
bool error(const char *fmt, const Args &...args)
Definition: logging.h:263
#define BOOST_CHECK(expr)
Definition: object.cpp:17
bool IsDeprecatedRPCEnabled(const ArgsManager &args, const std::string &method)
Definition: server.cpp:407
BOOST_AUTO_TEST_CASE(server_IsDeprecatedRPCEnabled)