Skip to content

Commit c141c4e

Browse files
committed
Fix tests
1 parent d2f806e commit c141c4e

File tree

2 files changed

+27
-9
lines changed

2 files changed

+27
-9
lines changed

src/rpc/handlers/LedgerEntry.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ LedgerEntryHandler::process(LedgerEntryHandler::Input input, Context const& ctx)
183183
auto const account = ripple::parseBase58<ripple::AccountID>(
184184
boost::json::value_to<std::string>(input.permissionedDomain->at(JS(account)))
185185
);
186-
auto const seq = input.permissionedDomain->at(JS(seq)).as_uint64();
186+
auto const seq = input.permissionedDomain->at(JS(seq)).as_int64();
187187
key = ripple::keylet::permissionedDomain(*account, seq).key;
188188
} else {
189189
// Must specify 1 of the following fields to indicate what type

tests/unit/rpc/handlers/LedgerEntryTests.cpp

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2922,11 +2922,30 @@ generateTestValuesForNormalPathTest()
29222922
.testName = "PermissionedDomainViaString",
29232923
.testJson = fmt::format(
29242924
R"json({{
2925-
"permissioned_domain": "{}"
2926-
}})json",
2925+
"binary": true,
2926+
"permissioned_domain": "{}"
2927+
}})json",
29272928
kINDEX1
29282929
),
29292930
.expectedIndex = ripple::uint256(kINDEX1),
2931+
.mockedEntity = createPermissionedDomainObject(kACCOUNT, kRANGE_MAX, 0, 0, ripple::uint256{0}, 0)
2932+
},
2933+
NormalPathTestBundle{
2934+
.testName = "PermissionedDomainViaObject",
2935+
.testJson = fmt::format(
2936+
R"json({{
2937+
"binary": true,
2938+
"permissioned_domain": {{
2939+
"account": "{}",
2940+
"seq": {}
2941+
}}
2942+
}})json",
2943+
kACCOUNT,
2944+
kRANGE_MAX
2945+
),
2946+
.expectedIndex =
2947+
ripple::keylet::permissionedDomain(ripple::parseBase58<ripple::AccountID>(kACCOUNT).value(), kRANGE_MAX)
2948+
.key,
29302949
.mockedEntity = createPermissionedDomainObject(kACCOUNT, kRANGE_MAX, kRANGE_MAX, 0, ripple::uint256{0}, 0)
29312950
}
29322951
};
@@ -2957,15 +2976,14 @@ TEST_P(RPCLedgerEntryNormalPathTest, NormalPath)
29572976
auto const req = json::parse(testBundle.testJson);
29582977
auto const output = handler.process(req, Context{yield});
29592978
ASSERT_TRUE(output);
2960-
EXPECT_EQ(output.result.value().at("ledger_hash").as_string(), kLEDGER_HASH);
2961-
EXPECT_EQ(output.result.value().at("ledger_index").as_uint64(), kRANGE_MAX);
2979+
auto const& outputJson = output.result.value();
2980+
EXPECT_EQ(outputJson.at("ledger_hash").as_string(), kLEDGER_HASH);
2981+
EXPECT_EQ(outputJson.at("ledger_index").as_uint64(), kRANGE_MAX);
29622982
EXPECT_EQ(
2963-
output.result.value().at("node_binary").as_string(),
2964-
ripple::strHex(testBundle.mockedEntity.getSerializer().peekData())
2983+
outputJson.at("node_binary").as_string(), ripple::strHex(testBundle.mockedEntity.getSerializer().peekData())
29652984
);
29662985
EXPECT_EQ(
2967-
ripple::uint256(boost::json::value_to<std::string>(output.result.value().at("index")).data()),
2968-
testBundle.expectedIndex
2986+
ripple::uint256(boost::json::value_to<std::string>(outputJson.at("index")).data()), testBundle.expectedIndex
29692987
);
29702988
});
29712989
}

0 commit comments

Comments
 (0)