mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-29 08:05:50 +00:00
Change an error code in account_lines to match rippled (#742)
Fixes #741
This commit is contained in:
@@ -90,8 +90,11 @@ public:
|
||||
spec([[maybe_unused]] uint32_t apiVersion) const
|
||||
{
|
||||
static auto const rpcSpec = RpcSpec{
|
||||
{JS(account), validation::Required{}, validation::AccountValidator},
|
||||
{JS(peer), validation::Type<std::string>{}, validation::AccountValidator},
|
||||
{JS(account),
|
||||
validation::Required{},
|
||||
validation::WithCustomError{validation::AccountValidator, Status(RippledError::rpcACT_MALFORMED)}},
|
||||
{JS(peer),
|
||||
validation::WithCustomError{validation::AccountValidator, Status(RippledError::rpcACT_MALFORMED)}},
|
||||
{JS(ignore_default), validation::Type<bool>{}},
|
||||
{JS(ledger_hash), validation::Uint256HexStringValidator},
|
||||
{JS(limit), validation::Type<uint32_t>{}, validation::Between{10, 400}},
|
||||
|
||||
@@ -206,7 +206,7 @@ TEST_F(RPCAccountLinesHandlerTest, AccountInvalidFormat)
|
||||
ASSERT_FALSE(output);
|
||||
auto const err = RPC::makeError(output.error());
|
||||
EXPECT_EQ(err.at("error").as_string(), "actMalformed");
|
||||
EXPECT_EQ(err.at("error_message").as_string(), "accountMalformed");
|
||||
EXPECT_EQ(err.at("error_message").as_string(), "Account malformed.");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -223,8 +223,43 @@ TEST_F(RPCAccountLinesHandlerTest, AccountNotString)
|
||||
ASSERT_FALSE(output);
|
||||
|
||||
auto const err = RPC::makeError(output.error());
|
||||
EXPECT_EQ(err.at("error").as_string(), "invalidParams");
|
||||
EXPECT_EQ(err.at("error_message").as_string(), "accountNotString");
|
||||
EXPECT_EQ(err.at("error").as_string(), "actMalformed");
|
||||
EXPECT_EQ(err.at("error_message").as_string(), "Account malformed.");
|
||||
});
|
||||
}
|
||||
|
||||
TEST_F(RPCAccountLinesHandlerTest, PeerInvalidFormat)
|
||||
{
|
||||
runSpawn([this](auto& yield) {
|
||||
auto const handler = AnyHandler{AccountLinesHandler{mockBackendPtr}};
|
||||
auto const input = json::parse(
|
||||
R"({
|
||||
"account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"peer": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jp"
|
||||
})");
|
||||
auto const output = handler.process(input, Context{std::ref(yield)});
|
||||
ASSERT_FALSE(output);
|
||||
auto const err = RPC::makeError(output.error());
|
||||
EXPECT_EQ(err.at("error").as_string(), "actMalformed");
|
||||
EXPECT_EQ(err.at("error_message").as_string(), "Account malformed.");
|
||||
});
|
||||
}
|
||||
|
||||
TEST_F(RPCAccountLinesHandlerTest, PeerNotString)
|
||||
{
|
||||
runSpawn([this](auto& yield) {
|
||||
auto const handler = AnyHandler{AccountLinesHandler{mockBackendPtr}};
|
||||
auto const input = json::parse(
|
||||
R"({
|
||||
"account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"peer": 12
|
||||
})");
|
||||
auto const output = handler.process(input, Context{std::ref(yield)});
|
||||
ASSERT_FALSE(output);
|
||||
|
||||
auto const err = RPC::makeError(output.error());
|
||||
EXPECT_EQ(err.at("error").as_string(), "actMalformed");
|
||||
EXPECT_EQ(err.at("error_message").as_string(), "Account malformed.");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user