mirror of
https://github.com/XRPLF/clio.git
synced 2025-12-06 17:27:58 +00:00
@@ -106,6 +106,16 @@ generateTestValuesForParametersTest()
|
||||
R"({"account":"rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun", "limit":"1"})",
|
||||
"invalidParams",
|
||||
"Invalid parameters."},
|
||||
AccountObjectsParamTestCaseBundle{
|
||||
"LimitNagetive",
|
||||
R"({"account":"rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun", "limit":-1})",
|
||||
"invalidParams",
|
||||
"Invalid parameters."},
|
||||
AccountObjectsParamTestCaseBundle{
|
||||
"LimitZero",
|
||||
R"({"account":"rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun", "limit":0})",
|
||||
"invalidParams",
|
||||
"Invalid parameters."},
|
||||
AccountObjectsParamTestCaseBundle{
|
||||
"MarkerNotString",
|
||||
R"({"account":"rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun", "marker":9})",
|
||||
@@ -148,7 +158,7 @@ TEST_P(AccountObjectsParameterTest, InvalidParams)
|
||||
runSpawn([&, this](auto yield) {
|
||||
auto const handler = AnyHandler{AccountObjectsHandler{mockBackendPtr}};
|
||||
auto const req = json::parse(testBundle.testJson);
|
||||
auto const output = handler.process(req, Context{std::ref(yield)});
|
||||
auto const output = handler.process(req, Context{yield});
|
||||
ASSERT_FALSE(output);
|
||||
auto const err = RPC::makeError(output.error());
|
||||
EXPECT_EQ(err.at("error").as_string(), testBundle.expectedError);
|
||||
@@ -174,7 +184,7 @@ TEST_F(RPCAccountObjectsHandlerTest, LedgerNonExistViaIntSequence)
|
||||
ACCOUNT));
|
||||
auto const handler = AnyHandler{AccountObjectsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{std::ref(yield)});
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
ASSERT_FALSE(output);
|
||||
auto const err = RPC::makeError(output.error());
|
||||
EXPECT_EQ(err.at("error").as_string(), "lgrNotFound");
|
||||
@@ -199,7 +209,7 @@ TEST_F(RPCAccountObjectsHandlerTest, LedgerNonExistViaStringSequence)
|
||||
ACCOUNT));
|
||||
auto const handler = AnyHandler{AccountObjectsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{std::ref(yield)});
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
ASSERT_FALSE(output);
|
||||
auto const err = RPC::makeError(output.error());
|
||||
EXPECT_EQ(err.at("error").as_string(), "lgrNotFound");
|
||||
@@ -226,7 +236,7 @@ TEST_F(RPCAccountObjectsHandlerTest, LedgerNonExistViaHash)
|
||||
LEDGERHASH));
|
||||
auto const handler = AnyHandler{AccountObjectsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{std::ref(yield)});
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
ASSERT_FALSE(output);
|
||||
auto const err = RPC::makeError(output.error());
|
||||
EXPECT_EQ(err.at("error").as_string(), "lgrNotFound");
|
||||
@@ -253,7 +263,7 @@ TEST_F(RPCAccountObjectsHandlerTest, AccountNotExist)
|
||||
ACCOUNT));
|
||||
auto const handler = AnyHandler{AccountObjectsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{std::ref(yield)});
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
ASSERT_FALSE(output);
|
||||
auto const err = RPC::makeError(output.error());
|
||||
EXPECT_EQ(err.at("error").as_string(), "actNotFound");
|
||||
@@ -332,7 +342,7 @@ TEST_F(RPCAccountObjectsHandlerTest, DefaultParameterNoNFTFound)
|
||||
|
||||
auto const handler = AnyHandler{AccountObjectsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{std::ref(yield)});
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
ASSERT_TRUE(output);
|
||||
EXPECT_EQ(*output, json::parse(expectedOut));
|
||||
});
|
||||
@@ -385,7 +395,7 @@ TEST_F(RPCAccountObjectsHandlerTest, Limit)
|
||||
|
||||
auto const handler = AnyHandler{AccountObjectsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{std::ref(yield)});
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
ASSERT_TRUE(output);
|
||||
EXPECT_EQ(output->as_object().at("account_objects").as_array().size(), limit);
|
||||
EXPECT_EQ(output->as_object().at("marker").as_string(), fmt::format("{},{}", INDEX1, 0));
|
||||
@@ -435,7 +445,7 @@ TEST_F(RPCAccountObjectsHandlerTest, Marker)
|
||||
|
||||
auto const handler = AnyHandler{AccountObjectsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{std::ref(yield)});
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
ASSERT_TRUE(output);
|
||||
EXPECT_EQ(output->as_object().at("account_objects").as_array().size(), limit - 1);
|
||||
EXPECT_FALSE(output->as_object().contains("marker"));
|
||||
@@ -496,7 +506,7 @@ TEST_F(RPCAccountObjectsHandlerTest, MultipleDirNoNFT)
|
||||
|
||||
auto const handler = AnyHandler{AccountObjectsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{std::ref(yield)});
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
ASSERT_TRUE(output);
|
||||
EXPECT_EQ(output->as_object().at("account_objects").as_array().size(), count * 2);
|
||||
EXPECT_EQ(output->as_object().at("marker").as_string(), fmt::format("{},{}", INDEX1, nextpage));
|
||||
@@ -554,7 +564,7 @@ TEST_F(RPCAccountObjectsHandlerTest, TypeFilter)
|
||||
|
||||
auto const handler = AnyHandler{AccountObjectsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{std::ref(yield)});
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
ASSERT_TRUE(output);
|
||||
EXPECT_EQ(output->as_object().at("account_objects").as_array().size(), 1);
|
||||
});
|
||||
@@ -610,7 +620,7 @@ TEST_F(RPCAccountObjectsHandlerTest, TypeFilterReturnEmpty)
|
||||
|
||||
auto const handler = AnyHandler{AccountObjectsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{std::ref(yield)});
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
ASSERT_TRUE(output);
|
||||
EXPECT_EQ(output->as_object().at("account_objects").as_array().size(), 0);
|
||||
});
|
||||
@@ -673,7 +683,7 @@ TEST_F(RPCAccountObjectsHandlerTest, DeletionBlockersOnlyFilter)
|
||||
|
||||
auto const handler = AnyHandler{AccountObjectsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{std::ref(yield)});
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
ASSERT_TRUE(output);
|
||||
EXPECT_EQ(output->as_object().at("account_objects").as_array().size(), 2);
|
||||
});
|
||||
@@ -725,7 +735,7 @@ TEST_F(RPCAccountObjectsHandlerTest, DeletionBlockersOnlyFilterWithTypeFilter)
|
||||
|
||||
auto const handler = AnyHandler{AccountObjectsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{std::ref(yield)});
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
ASSERT_TRUE(output);
|
||||
EXPECT_EQ(output->as_object().at("account_objects").as_array().size(), 1);
|
||||
});
|
||||
@@ -792,7 +802,7 @@ TEST_F(RPCAccountObjectsHandlerTest, DeletionBlockersOnlyFilterEmptyResult)
|
||||
|
||||
auto const handler = AnyHandler{AccountObjectsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{std::ref(yield)});
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
ASSERT_TRUE(output);
|
||||
EXPECT_EQ(output->as_object().at("account_objects").as_array().size(), 0);
|
||||
});
|
||||
@@ -858,7 +868,7 @@ TEST_F(RPCAccountObjectsHandlerTest, DeletionBlockersOnlyFilterWithIncompatibleT
|
||||
|
||||
auto const handler = AnyHandler{AccountObjectsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{std::ref(yield)});
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
ASSERT_TRUE(output);
|
||||
EXPECT_EQ(output->as_object().at("account_objects").as_array().size(), 0);
|
||||
});
|
||||
@@ -976,7 +986,7 @@ TEST_F(RPCAccountObjectsHandlerTest, NFTMixOtherObjects)
|
||||
|
||||
auto const handler = AnyHandler{AccountObjectsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{std::ref(yield)});
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
ASSERT_TRUE(output);
|
||||
EXPECT_EQ(*output, json::parse(expectedOut));
|
||||
});
|
||||
@@ -1022,7 +1032,7 @@ TEST_F(RPCAccountObjectsHandlerTest, NFTReachLimitReturnMarker)
|
||||
|
||||
auto const handler = AnyHandler{AccountObjectsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{std::ref(yield)});
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
ASSERT_TRUE(output);
|
||||
EXPECT_EQ(output.value().as_object().at("account_objects").as_array().size(), 10);
|
||||
EXPECT_EQ(
|
||||
@@ -1075,7 +1085,7 @@ TEST_F(RPCAccountObjectsHandlerTest, NFTReachLimitNoMarker)
|
||||
|
||||
auto const handler = AnyHandler{AccountObjectsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{std::ref(yield)});
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
ASSERT_TRUE(output);
|
||||
EXPECT_EQ(output.value().as_object().at("account_objects").as_array().size(), 11);
|
||||
//"0000000000000000000000000000000000000000000000000000000000000000,4294967295"
|
||||
@@ -1158,7 +1168,7 @@ TEST_F(RPCAccountObjectsHandlerTest, NFTMarker)
|
||||
|
||||
auto const handler = AnyHandler{AccountObjectsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{std::ref(yield)});
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
ASSERT_TRUE(output);
|
||||
EXPECT_EQ(output.value().as_object().at("account_objects").as_array().size(), 11 + 3);
|
||||
EXPECT_FALSE(output.value().as_object().contains("marker"));
|
||||
@@ -1219,7 +1229,7 @@ TEST_F(RPCAccountObjectsHandlerTest, NFTMarkerNoMoreNFT)
|
||||
|
||||
auto const handler = AnyHandler{AccountObjectsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{std::ref(yield)});
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
ASSERT_TRUE(output);
|
||||
EXPECT_EQ(output.value().as_object().at("account_objects").as_array().size(), 3);
|
||||
EXPECT_FALSE(output.value().as_object().contains("marker"));
|
||||
@@ -1251,7 +1261,7 @@ TEST_F(RPCAccountObjectsHandlerTest, NFTMarkerNotInRange)
|
||||
|
||||
auto const handler = AnyHandler{AccountObjectsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{std::ref(yield)});
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
ASSERT_FALSE(output);
|
||||
auto const err = RPC::makeError(output.error());
|
||||
EXPECT_EQ(err.at("error").as_string(), "invalidParams");
|
||||
@@ -1288,7 +1298,7 @@ TEST_F(RPCAccountObjectsHandlerTest, NFTMarkerNotExist)
|
||||
|
||||
auto const handler = AnyHandler{AccountObjectsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{std::ref(yield)});
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
ASSERT_FALSE(output);
|
||||
auto const err = RPC::makeError(output.error());
|
||||
EXPECT_EQ(err.at("error").as_string(), "invalidParams");
|
||||
@@ -1369,7 +1379,7 @@ TEST_F(RPCAccountObjectsHandlerTest, NFTLimitAdjust)
|
||||
|
||||
auto const handler = AnyHandler{AccountObjectsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{std::ref(yield)});
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
ASSERT_TRUE(output);
|
||||
EXPECT_EQ(output.value().as_object().at("account_objects").as_array().size(), 12);
|
||||
// marker not in NFT "1B8590C01B0006EDFA9ED60296DD052DC5E90F99659B25014D08E1BC983515BC,0"
|
||||
@@ -1468,7 +1478,7 @@ TEST_F(RPCAccountObjectsHandlerTest, FilterNFT)
|
||||
|
||||
auto const handler = AnyHandler{AccountObjectsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{std::ref(yield)});
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
ASSERT_TRUE(output);
|
||||
EXPECT_EQ(*output, json::parse(expectedOut));
|
||||
});
|
||||
@@ -1520,7 +1530,7 @@ TEST_F(RPCAccountObjectsHandlerTest, NFTZeroMarkerNotAffectOtherMarker)
|
||||
|
||||
auto const handler = AnyHandler{AccountObjectsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{std::ref(yield)});
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
ASSERT_TRUE(output);
|
||||
EXPECT_EQ(output->as_object().at("account_objects").as_array().size(), limit);
|
||||
EXPECT_EQ(output->as_object().at("marker").as_string(), fmt::format("{},{}", INDEX1, 0));
|
||||
@@ -1602,7 +1612,7 @@ TEST_F(RPCAccountObjectsHandlerTest, LimitLessThanMin)
|
||||
|
||||
auto const handler = AnyHandler{AccountObjectsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{std::ref(yield)});
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
ASSERT_TRUE(output);
|
||||
EXPECT_EQ(*output, json::parse(expectedOut));
|
||||
});
|
||||
@@ -1683,7 +1693,7 @@ TEST_F(RPCAccountObjectsHandlerTest, LimitMoreThanMax)
|
||||
|
||||
auto const handler = AnyHandler{AccountObjectsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{std::ref(yield)});
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
ASSERT_TRUE(output);
|
||||
EXPECT_EQ(*output, json::parse(expectedOut));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user