mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-20 11:45:53 +00:00
@@ -35,12 +35,9 @@ constexpr static auto ACCOUNT2 = "rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun";
|
||||
constexpr static auto LEDGERHASH = "4BC50C9B0D8515D3EAAE1E74B29A95804346C491EE1A95BF25E4AAB854A6A652";
|
||||
constexpr static auto INDEX1 = "1B8590C01B0006EDFA9ED60296DD052DC5E90F99659B25014D08E1BC983515BC";
|
||||
|
||||
class RPCAccountInfoHandlerTest : public HandlerBaseTest
|
||||
{
|
||||
};
|
||||
class RPCAccountInfoHandlerTest : public HandlerBaseTest {};
|
||||
|
||||
struct AccountInfoParamTestCaseBundle
|
||||
{
|
||||
struct AccountInfoParamTestCaseBundle {
|
||||
std::string testName;
|
||||
std::string testJson;
|
||||
std::string expectedError;
|
||||
@@ -49,13 +46,11 @@ struct AccountInfoParamTestCaseBundle
|
||||
|
||||
// parameterized test cases for parameters check
|
||||
struct AccountInfoParameterTest : public RPCAccountInfoHandlerTest,
|
||||
public WithParamInterface<AccountInfoParamTestCaseBundle>
|
||||
{
|
||||
struct NameGenerator
|
||||
{
|
||||
public WithParamInterface<AccountInfoParamTestCaseBundle> {
|
||||
struct NameGenerator {
|
||||
template <class ParamType>
|
||||
std::string
|
||||
operator()(const testing::TestParamInfo<ParamType>& info) const
|
||||
operator()(testing::TestParamInfo<ParamType> const& info) const
|
||||
{
|
||||
auto bundle = static_cast<AccountInfoParamTestCaseBundle>(info.param);
|
||||
return bundle.testName;
|
||||
@@ -99,7 +94,8 @@ INSTANTIATE_TEST_CASE_P(
|
||||
RPCAccountInfoGroup1,
|
||||
AccountInfoParameterTest,
|
||||
ValuesIn(generateTestValuesForParametersTest()),
|
||||
AccountInfoParameterTest::NameGenerator{});
|
||||
AccountInfoParameterTest::NameGenerator{}
|
||||
);
|
||||
|
||||
TEST_P(AccountInfoParameterTest, InvalidParams)
|
||||
{
|
||||
@@ -151,7 +147,8 @@ TEST_F(RPCAccountInfoHandlerTest, LedgerNonExistViaIntSequence)
|
||||
"account": "{}",
|
||||
"ledger_index": 30
|
||||
}})",
|
||||
ACCOUNT));
|
||||
ACCOUNT
|
||||
));
|
||||
auto const handler = AnyHandler{AccountInfoHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
@@ -177,7 +174,8 @@ TEST_F(RPCAccountInfoHandlerTest, LedgerNonExistViaStringSequence)
|
||||
"account": "{}",
|
||||
"ledger_index": "30"
|
||||
}})",
|
||||
ACCOUNT));
|
||||
ACCOUNT
|
||||
));
|
||||
auto const handler = AnyHandler{AccountInfoHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
@@ -205,7 +203,8 @@ TEST_F(RPCAccountInfoHandlerTest, LedgerNonExistViaHash)
|
||||
"ledger_hash": "{}"
|
||||
}})",
|
||||
ACCOUNT,
|
||||
LEDGERHASH));
|
||||
LEDGERHASH
|
||||
));
|
||||
auto const handler = AnyHandler{AccountInfoHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
@@ -233,7 +232,8 @@ TEST_F(RPCAccountInfoHandlerTest, AccountNotExist)
|
||||
R"({{
|
||||
"account": "{}"
|
||||
}})",
|
||||
ACCOUNT));
|
||||
ACCOUNT
|
||||
));
|
||||
auto const handler = AnyHandler{AccountInfoHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
@@ -262,7 +262,8 @@ TEST_F(RPCAccountInfoHandlerTest, AccountInvalid)
|
||||
R"({{
|
||||
"account": "{}"
|
||||
}})",
|
||||
ACCOUNT));
|
||||
ACCOUNT
|
||||
));
|
||||
auto const handler = AnyHandler{AccountInfoHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
@@ -300,7 +301,8 @@ TEST_F(RPCAccountInfoHandlerTest, SignerListsInvalid)
|
||||
"account": "{}",
|
||||
"signer_lists": true
|
||||
}})",
|
||||
ACCOUNT));
|
||||
ACCOUNT
|
||||
));
|
||||
auto const handler = AnyHandler{AccountInfoHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
@@ -378,7 +380,8 @@ TEST_F(RPCAccountInfoHandlerTest, SignerListsTrueV2)
|
||||
INDEX1,
|
||||
ACCOUNT1,
|
||||
ACCOUNT2,
|
||||
LEDGERHASH);
|
||||
LEDGERHASH
|
||||
);
|
||||
auto const rawBackendPtr = dynamic_cast<MockBackend*>(mockBackendPtr.get());
|
||||
ASSERT_NE(rawBackendPtr, nullptr);
|
||||
mockBackendPtr->updateRange(10); // min
|
||||
@@ -404,7 +407,8 @@ TEST_F(RPCAccountInfoHandlerTest, SignerListsTrueV2)
|
||||
"account": "{}",
|
||||
"signer_lists": true
|
||||
}})",
|
||||
ACCOUNT));
|
||||
ACCOUNT
|
||||
));
|
||||
auto const handler = AnyHandler{AccountInfoHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{.yield = yield, .apiVersion = 2});
|
||||
@@ -480,7 +484,8 @@ TEST_F(RPCAccountInfoHandlerTest, SignerListsTrueV1)
|
||||
INDEX1,
|
||||
ACCOUNT1,
|
||||
ACCOUNT2,
|
||||
LEDGERHASH);
|
||||
LEDGERHASH
|
||||
);
|
||||
auto const rawBackendPtr = dynamic_cast<MockBackend*>(mockBackendPtr.get());
|
||||
ASSERT_NE(rawBackendPtr, nullptr);
|
||||
mockBackendPtr->updateRange(10); // min
|
||||
@@ -506,7 +511,8 @@ TEST_F(RPCAccountInfoHandlerTest, SignerListsTrueV1)
|
||||
"account": "{}",
|
||||
"signer_lists": true
|
||||
}})",
|
||||
ACCOUNT));
|
||||
ACCOUNT
|
||||
));
|
||||
auto const handler = AnyHandler{AccountInfoHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{.yield = yield, .apiVersion = 1});
|
||||
@@ -548,7 +554,8 @@ TEST_F(RPCAccountInfoHandlerTest, Flags)
|
||||
}})",
|
||||
ACCOUNT,
|
||||
INDEX1,
|
||||
LEDGERHASH);
|
||||
LEDGERHASH
|
||||
);
|
||||
auto const rawBackendPtr = dynamic_cast<MockBackend*>(mockBackendPtr.get());
|
||||
ASSERT_NE(rawBackendPtr, nullptr);
|
||||
mockBackendPtr->updateRange(10); // min
|
||||
@@ -568,7 +575,8 @@ TEST_F(RPCAccountInfoHandlerTest, Flags)
|
||||
200,
|
||||
2,
|
||||
INDEX1,
|
||||
2);
|
||||
2
|
||||
);
|
||||
ON_CALL(*rawBackendPtr, doFetchLedgerObject(accountKk, 30, _))
|
||||
.WillByDefault(Return(accountRoot.getSerializer().peekData()));
|
||||
ON_CALL(*rawBackendPtr, doFetchLedgerObject(ripple::keylet::amendments().key, 30, _))
|
||||
@@ -579,7 +587,8 @@ TEST_F(RPCAccountInfoHandlerTest, Flags)
|
||||
R"({{
|
||||
"account": "{}"
|
||||
}})",
|
||||
ACCOUNT));
|
||||
ACCOUNT
|
||||
));
|
||||
auto const handler = AnyHandler{AccountInfoHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
@@ -611,7 +620,8 @@ TEST_F(RPCAccountInfoHandlerTest, IdentAndSignerListsFalse)
|
||||
R"({{
|
||||
"ident": "{}"
|
||||
}})",
|
||||
ACCOUNT));
|
||||
ACCOUNT
|
||||
));
|
||||
auto const handler = AnyHandler{AccountInfoHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
@@ -657,7 +667,8 @@ TEST_F(RPCAccountInfoHandlerTest, DisallowIncoming)
|
||||
}})",
|
||||
ACCOUNT,
|
||||
INDEX1,
|
||||
LEDGERHASH);
|
||||
LEDGERHASH
|
||||
);
|
||||
auto const rawBackendPtr = dynamic_cast<MockBackend*>(mockBackendPtr.get());
|
||||
ASSERT_NE(rawBackendPtr, nullptr);
|
||||
mockBackendPtr->updateRange(10); // min
|
||||
@@ -678,7 +689,8 @@ TEST_F(RPCAccountInfoHandlerTest, DisallowIncoming)
|
||||
200,
|
||||
2,
|
||||
INDEX1,
|
||||
2);
|
||||
2
|
||||
);
|
||||
ON_CALL(*rawBackendPtr, doFetchLedgerObject(accountKk, 30, _))
|
||||
.WillByDefault(Return(accountRoot.getSerializer().peekData()));
|
||||
ON_CALL(*rawBackendPtr, doFetchLedgerObject(ripple::keylet::amendments().key, 30, _))
|
||||
@@ -689,7 +701,8 @@ TEST_F(RPCAccountInfoHandlerTest, DisallowIncoming)
|
||||
R"({{
|
||||
"account": "{}"
|
||||
}})",
|
||||
ACCOUNT));
|
||||
ACCOUNT
|
||||
));
|
||||
auto const handler = AnyHandler{AccountInfoHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
@@ -732,7 +745,8 @@ TEST_F(RPCAccountInfoHandlerTest, Clawback)
|
||||
}})",
|
||||
ACCOUNT,
|
||||
INDEX1,
|
||||
LEDGERHASH);
|
||||
LEDGERHASH
|
||||
);
|
||||
auto const rawBackendPtr = dynamic_cast<MockBackend*>(mockBackendPtr.get());
|
||||
ASSERT_NE(rawBackendPtr, nullptr);
|
||||
mockBackendPtr->updateRange(10); // min
|
||||
@@ -752,7 +766,8 @@ TEST_F(RPCAccountInfoHandlerTest, Clawback)
|
||||
200,
|
||||
2,
|
||||
INDEX1,
|
||||
2);
|
||||
2
|
||||
);
|
||||
ON_CALL(*rawBackendPtr, doFetchLedgerObject(accountKk, 30, _))
|
||||
.WillByDefault(Return(accountRoot.getSerializer().peekData()));
|
||||
ON_CALL(*rawBackendPtr, doFetchLedgerObject(ripple::keylet::amendments().key, 30, _))
|
||||
@@ -763,7 +778,8 @@ TEST_F(RPCAccountInfoHandlerTest, Clawback)
|
||||
R"({{
|
||||
"account": "{}"
|
||||
}})",
|
||||
ACCOUNT));
|
||||
ACCOUNT
|
||||
));
|
||||
auto const handler = AnyHandler{AccountInfoHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
|
||||
Reference in New Issue
Block a user