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

@@ -59,7 +59,7 @@ TEST_F(RPCAccountCurrenciesHandlerTest, AccountNotExist)
ACCOUNT));
auto const handler = AnyHandler{AccountCurrenciesHandler{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");
@@ -83,7 +83,7 @@ TEST_F(RPCAccountCurrenciesHandlerTest, LedgerNonExistViaIntSequence)
ACCOUNT));
auto const handler = AnyHandler{AccountCurrenciesHandler{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");
@@ -110,7 +110,7 @@ TEST_F(RPCAccountCurrenciesHandlerTest, LedgerNonExistViaStringSequence)
seq));
auto const handler = AnyHandler{AccountCurrenciesHandler{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");
@@ -137,7 +137,7 @@ TEST_F(RPCAccountCurrenciesHandlerTest, LedgerNonExistViaHash)
LEDGERHASH));
auto const handler = AnyHandler{AccountCurrenciesHandler{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");
@@ -204,7 +204,7 @@ TEST_F(RPCAccountCurrenciesHandlerTest, DefaultParameter)
ACCOUNT));
auto const handler = AnyHandler{AccountCurrenciesHandler{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(OUTPUT));
});
@@ -244,7 +244,7 @@ TEST_F(RPCAccountCurrenciesHandlerTest, RequestViaLegderHash)
LEDGERHASH));
auto const handler = AnyHandler{AccountCurrenciesHandler{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);
});
}
@@ -285,7 +285,7 @@ TEST_F(RPCAccountCurrenciesHandlerTest, RequestViaLegderSeq)
ledgerSeq));
auto const handler = AnyHandler{AccountCurrenciesHandler{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("ledger_index").as_uint64(), ledgerSeq);
});