Return error when limit<=0 (#804)

Fix #806
This commit is contained in:
cyan317
2023-08-02 15:34:42 +01:00
committed by GitHub
parent 1804e3e9c0
commit c90bc15959
45 changed files with 832 additions and 562 deletions

View File

@@ -552,7 +552,7 @@ TEST_P(LedgerEntryParameterTest, InvalidParams)
runSpawn([&, this](auto yield) {
auto const handler = AnyHandler{LedgerEntryHandler{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());
@@ -592,7 +592,7 @@ TEST_P(IndexTest, InvalidIndexUint256)
"{}": "invalid"
}})",
index));
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());
@@ -611,7 +611,7 @@ TEST_P(IndexTest, InvalidIndexNotString)
"{}": 123
}})",
index));
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());
@@ -642,7 +642,7 @@ TEST_F(RPCLedgerEntryTest, LedgerEntryNotFound)
"account_root": "{}"
}})",
ACCOUNT));
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(), "entryNotFound");
@@ -917,7 +917,7 @@ TEST_P(RPCLedgerEntryNormalPathTest, NormalPath)
runSpawn([&, this](auto yield) {
auto const handler = AnyHandler{LedgerEntryHandler{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_TRUE(output);
EXPECT_EQ(output.value().at("ledger_hash").as_string(), LEDGERHASH);
EXPECT_EQ(output.value().at("ledger_index").as_uint64(), RANGEMAX);
@@ -972,7 +972,7 @@ TEST_F(RPCLedgerEntryTest, BinaryFalse)
"payment_channel": "{}"
}})",
INDEX1));
auto const output = handler.process(req, Context{std::ref(yield)});
auto const output = handler.process(req, Context{yield});
ASSERT_TRUE(output);
EXPECT_EQ(*output, json::parse(OUT));
});
@@ -1001,7 +1001,7 @@ TEST_F(RPCLedgerEntryTest, UnexpectedLedgerType)
"check": "{}"
}})",
INDEX1));
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(), "unexpectedLedgerType");
@@ -1026,7 +1026,7 @@ TEST_F(RPCLedgerEntryTest, LedgerNotExistViaIntSequence)
}})",
INDEX1,
RANGEMAX));
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(), "lgrNotFound");
@@ -1052,7 +1052,7 @@ TEST_F(RPCLedgerEntryTest, LedgerNotExistViaStringSequence)
}})",
INDEX1,
RANGEMAX));
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(), "lgrNotFound");
@@ -1078,7 +1078,7 @@ TEST_F(RPCLedgerEntryTest, LedgerNotExistViaHash)
}})",
INDEX1,
LEDGERHASH));
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(), "lgrNotFound");