mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-28 07:35:52 +00:00
@@ -40,12 +40,9 @@ using namespace rpc;
|
||||
namespace json = boost::json;
|
||||
using namespace testing;
|
||||
|
||||
class RPCAccountNFTsHandlerTest : public HandlerBaseTest
|
||||
{
|
||||
};
|
||||
class RPCAccountNFTsHandlerTest : public HandlerBaseTest {};
|
||||
|
||||
struct AccountNFTParamTestCaseBundle
|
||||
{
|
||||
struct AccountNFTParamTestCaseBundle {
|
||||
std::string testName;
|
||||
std::string testJson;
|
||||
std::string expectedError;
|
||||
@@ -54,13 +51,11 @@ struct AccountNFTParamTestCaseBundle
|
||||
|
||||
// parameterized test cases for parameters check
|
||||
struct AccountNFTParameterTest : public RPCAccountNFTsHandlerTest,
|
||||
public WithParamInterface<AccountNFTParamTestCaseBundle>
|
||||
{
|
||||
struct NameGenerator
|
||||
{
|
||||
public WithParamInterface<AccountNFTParamTestCaseBundle> {
|
||||
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<AccountNFTParamTestCaseBundle>(info.param);
|
||||
return bundle.testName;
|
||||
@@ -145,7 +140,8 @@ INSTANTIATE_TEST_CASE_P(
|
||||
RPCAccountNFTsGroup1,
|
||||
AccountNFTParameterTest,
|
||||
ValuesIn(generateTestValuesForParametersTest()),
|
||||
AccountNFTParameterTest::NameGenerator{});
|
||||
AccountNFTParameterTest::NameGenerator{}
|
||||
);
|
||||
|
||||
TEST_P(AccountNFTParameterTest, InvalidParams)
|
||||
{
|
||||
@@ -178,7 +174,8 @@ TEST_F(RPCAccountNFTsHandlerTest, LedgerNotFoundViaHash)
|
||||
"ledger_hash":"{}"
|
||||
}})",
|
||||
ACCOUNT,
|
||||
LEDGERHASH));
|
||||
LEDGERHASH
|
||||
));
|
||||
auto const handler = AnyHandler{AccountNFTsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
@@ -206,7 +203,8 @@ TEST_F(RPCAccountNFTsHandlerTest, LedgerNotFoundViaStringIndex)
|
||||
"ledger_index":"{}"
|
||||
}})",
|
||||
ACCOUNT,
|
||||
seq));
|
||||
seq
|
||||
));
|
||||
auto const handler = AnyHandler{AccountNFTsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
@@ -234,7 +232,8 @@ TEST_F(RPCAccountNFTsHandlerTest, LedgerNotFoundViaIntIndex)
|
||||
"ledger_index":{}
|
||||
}})",
|
||||
ACCOUNT,
|
||||
seq));
|
||||
seq
|
||||
));
|
||||
auto const handler = AnyHandler{AccountNFTsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
@@ -262,7 +261,8 @@ TEST_F(RPCAccountNFTsHandlerTest, AccountNotFound)
|
||||
R"({{
|
||||
"account":"{}"
|
||||
}})",
|
||||
ACCOUNT));
|
||||
ACCOUNT
|
||||
));
|
||||
auto const handler = AnyHandler{AccountNFTsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
@@ -300,7 +300,8 @@ TEST_F(RPCAccountNFTsHandlerTest, NormalPath)
|
||||
FLAG,
|
||||
ISSUER,
|
||||
TAXON,
|
||||
SERIAL);
|
||||
SERIAL
|
||||
);
|
||||
auto const rawBackendPtr = dynamic_cast<MockBackend*>(mockBackendPtr.get());
|
||||
ASSERT_NE(rawBackendPtr, nullptr);
|
||||
mockBackendPtr->updateRange(MINSEQ);
|
||||
@@ -325,7 +326,8 @@ TEST_F(RPCAccountNFTsHandlerTest, NormalPath)
|
||||
R"({{
|
||||
"account":"{}"
|
||||
}})",
|
||||
ACCOUNT));
|
||||
ACCOUNT
|
||||
));
|
||||
auto const handler = AnyHandler{AccountNFTsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
@@ -363,7 +365,8 @@ TEST_F(RPCAccountNFTsHandlerTest, Limit)
|
||||
"limit":{}
|
||||
}})",
|
||||
ACCOUNT,
|
||||
limit));
|
||||
limit
|
||||
));
|
||||
auto const handler = AnyHandler{AccountNFTsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
@@ -400,7 +403,8 @@ TEST_F(RPCAccountNFTsHandlerTest, Marker)
|
||||
"marker":"{}"
|
||||
}})",
|
||||
ACCOUNT,
|
||||
PAGE));
|
||||
PAGE
|
||||
));
|
||||
auto const handler = AnyHandler{AccountNFTsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
@@ -437,7 +441,8 @@ TEST_F(RPCAccountNFTsHandlerTest, LimitLessThanMin)
|
||||
ISSUER,
|
||||
TAXON,
|
||||
SERIAL,
|
||||
AccountNFTsHandler::LIMIT_MIN);
|
||||
AccountNFTsHandler::LIMIT_MIN
|
||||
);
|
||||
auto const rawBackendPtr = dynamic_cast<MockBackend*>(mockBackendPtr.get());
|
||||
ASSERT_NE(rawBackendPtr, nullptr);
|
||||
mockBackendPtr->updateRange(MINSEQ);
|
||||
@@ -464,7 +469,8 @@ TEST_F(RPCAccountNFTsHandlerTest, LimitLessThanMin)
|
||||
"limit":{}
|
||||
}})",
|
||||
ACCOUNT,
|
||||
AccountNFTsHandler::LIMIT_MIN - 1));
|
||||
AccountNFTsHandler::LIMIT_MIN - 1
|
||||
));
|
||||
auto const handler = AnyHandler{AccountNFTsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
@@ -501,7 +507,8 @@ TEST_F(RPCAccountNFTsHandlerTest, LimitMoreThanMax)
|
||||
ISSUER,
|
||||
TAXON,
|
||||
SERIAL,
|
||||
AccountNFTsHandler::LIMIT_MAX);
|
||||
AccountNFTsHandler::LIMIT_MAX
|
||||
);
|
||||
auto const rawBackendPtr = dynamic_cast<MockBackend*>(mockBackendPtr.get());
|
||||
ASSERT_NE(rawBackendPtr, nullptr);
|
||||
mockBackendPtr->updateRange(MINSEQ);
|
||||
@@ -528,7 +535,8 @@ TEST_F(RPCAccountNFTsHandlerTest, LimitMoreThanMax)
|
||||
"limit":{}
|
||||
}})",
|
||||
ACCOUNT,
|
||||
AccountNFTsHandler::LIMIT_MAX + 1));
|
||||
AccountNFTsHandler::LIMIT_MAX + 1
|
||||
));
|
||||
auto const handler = AnyHandler{AccountNFTsHandler{mockBackendPtr}};
|
||||
runSpawn([&](auto yield) {
|
||||
auto const output = handler.process(input, Context{yield});
|
||||
|
||||
Reference in New Issue
Block a user