mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-04 10:45:50 +00:00
Enable the Beta RPC API (v2) for all unit tests: (#4573)
* Enable api_version 2, which is currently in beta. It is expected to be marked stable by the next stable release. * This does not change any defaults. * The only existing tests changed were one that set the same flag, which was now redundant, and a couple that tested versioning explicitly.
This commit is contained in:
@@ -49,6 +49,9 @@ setupConfigForUnitTests(Config& cfg)
|
||||
cfg.FEES.account_reserve = XRP(200).value().xrp().drops();
|
||||
cfg.FEES.owner_reserve = XRP(50).value().xrp().drops();
|
||||
|
||||
// The Beta API (currently v2) is always available to tests
|
||||
cfg.BETA_RPC_API = true;
|
||||
|
||||
cfg.overwrite(ConfigSection::nodeDatabase(), "type", "rwdb");
|
||||
cfg.overwrite(ConfigSection::nodeDatabase(), "path", "main");
|
||||
cfg.overwrite(SECTION_RELATIONAL_DB, "backend", "rwdb");
|
||||
|
||||
@@ -206,10 +206,7 @@ public:
|
||||
testSignerListsApiVersion2()
|
||||
{
|
||||
using namespace jtx;
|
||||
Env env{*this, envconfig([](std::unique_ptr<Config> c) {
|
||||
c->loadFromString("\n[beta_rpc_api]\n1\n");
|
||||
return c;
|
||||
})};
|
||||
Env env{*this};
|
||||
Account const alice{"alice"};
|
||||
env.fund(XRP(1000), alice);
|
||||
|
||||
|
||||
@@ -76,11 +76,16 @@ class Version_test : public beast::unit_test::suite
|
||||
std::to_string(RPC::apiMinimumSupportedVersion - 1) + "}");
|
||||
BEAST_EXPECT(badVersion(re));
|
||||
|
||||
BEAST_EXPECT(env.app().config().BETA_RPC_API);
|
||||
re = env.rpc(
|
||||
"json",
|
||||
"version",
|
||||
"{\"api_version\": " +
|
||||
std::to_string(RPC::apiMaximumSupportedVersion + 1) + "}");
|
||||
std::to_string(
|
||||
std::max(
|
||||
RPC::apiMaximumSupportedVersion, RPC::apiBetaVersion) +
|
||||
1) +
|
||||
"}");
|
||||
BEAST_EXPECT(badVersion(re));
|
||||
|
||||
re = env.rpc("json", "version", "{\"api_version\": \"a\"}");
|
||||
@@ -190,20 +195,25 @@ class Version_test : public beast::unit_test::suite
|
||||
using namespace test::jtx;
|
||||
Env env{*this};
|
||||
|
||||
BEAST_EXPECT(env.app().config().BETA_RPC_API);
|
||||
auto const without_api_verion = std::string("{ ") +
|
||||
"\"jsonrpc\": \"2.0\", "
|
||||
"\"ripplerpc\": \"2.0\", "
|
||||
"\"id\": 5, "
|
||||
"\"method\": \"version\", "
|
||||
"\"params\": {}}";
|
||||
auto const with_wrong_api_verion = std::string("{ ") +
|
||||
auto const with_wrong_api_verion =
|
||||
std::string("{ ") +
|
||||
"\"jsonrpc\": \"2.0\", "
|
||||
"\"ripplerpc\": \"2.0\", "
|
||||
"\"id\": 6, "
|
||||
"\"method\": \"version\", "
|
||||
"\"params\": { "
|
||||
"\"api_version\": " +
|
||||
std::to_string(RPC::apiMaximumSupportedVersion + 1) + "}}";
|
||||
std::to_string(
|
||||
std::max(RPC::apiMaximumSupportedVersion, RPC::apiBetaVersion) +
|
||||
1) +
|
||||
"}}";
|
||||
auto re = env.rpc(
|
||||
"json2",
|
||||
'[' + without_api_verion + ", " + with_wrong_api_verion + ']');
|
||||
|
||||
Reference in New Issue
Block a user