mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-30 16:45:51 +00:00
@@ -36,8 +36,7 @@ using TestUnsubscribeHandler = BaseUnsubscribeHandler<MockSubscriptionManager>;
|
||||
constexpr static auto ACCOUNT = "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn";
|
||||
constexpr static auto ACCOUNT2 = "rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun";
|
||||
|
||||
class RPCUnsubscribeTest : public HandlerBaseTest, public MockSubscriptionManagerTest
|
||||
{
|
||||
class RPCUnsubscribeTest : public HandlerBaseTest, public MockSubscriptionManagerTest {
|
||||
protected:
|
||||
void
|
||||
SetUp() override
|
||||
@@ -59,8 +58,7 @@ protected:
|
||||
std::shared_ptr<web::ConnectionBase> session_;
|
||||
};
|
||||
|
||||
struct UnsubscribeParamTestCaseBundle
|
||||
{
|
||||
struct UnsubscribeParamTestCaseBundle {
|
||||
std::string testName;
|
||||
std::string testJson;
|
||||
std::string expectedError;
|
||||
@@ -68,13 +66,11 @@ struct UnsubscribeParamTestCaseBundle
|
||||
};
|
||||
|
||||
// parameterized test cases for parameters check
|
||||
struct UnsubscribeParameterTest : public RPCUnsubscribeTest, public WithParamInterface<UnsubscribeParamTestCaseBundle>
|
||||
{
|
||||
struct NameGenerator
|
||||
{
|
||||
struct UnsubscribeParameterTest : public RPCUnsubscribeTest, public WithParamInterface<UnsubscribeParamTestCaseBundle> {
|
||||
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<UnsubscribeParamTestCaseBundle>(info.param);
|
||||
return bundle.testName;
|
||||
@@ -486,7 +482,8 @@ INSTANTIATE_TEST_CASE_P(
|
||||
RPCUnsubscribe,
|
||||
UnsubscribeParameterTest,
|
||||
ValuesIn(generateTestValuesForParametersTest()),
|
||||
UnsubscribeParameterTest::NameGenerator{});
|
||||
UnsubscribeParameterTest::NameGenerator{}
|
||||
);
|
||||
|
||||
TEST_P(UnsubscribeParameterTest, InvalidParams)
|
||||
{
|
||||
@@ -517,7 +514,8 @@ TEST_F(RPCUnsubscribeTest, Streams)
|
||||
auto const input = json::parse(
|
||||
R"({
|
||||
"streams": ["transactions_proposed","transactions","validations","manifests","book_changes","ledger"]
|
||||
})");
|
||||
})"
|
||||
);
|
||||
|
||||
MockSubscriptionManager* rawSubscriptionManagerPtr = mockSubscriptionManagerPtr.get();
|
||||
EXPECT_CALL(*rawSubscriptionManagerPtr, unsubLedger).Times(1);
|
||||
@@ -542,7 +540,8 @@ TEST_F(RPCUnsubscribeTest, Accounts)
|
||||
"accounts": ["{}","{}"]
|
||||
}})",
|
||||
ACCOUNT,
|
||||
ACCOUNT2));
|
||||
ACCOUNT2
|
||||
));
|
||||
|
||||
MockSubscriptionManager* rawSubscriptionManagerPtr = mockSubscriptionManagerPtr.get();
|
||||
EXPECT_CALL(*rawSubscriptionManagerPtr, unsubAccount(rpc::accountFromStringStrict(ACCOUNT).value(), _)).Times(1);
|
||||
@@ -563,7 +562,8 @@ TEST_F(RPCUnsubscribeTest, AccountsProposed)
|
||||
"accounts_proposed": ["{}","{}"]
|
||||
}})",
|
||||
ACCOUNT,
|
||||
ACCOUNT2));
|
||||
ACCOUNT2
|
||||
));
|
||||
|
||||
MockSubscriptionManager* rawSubscriptionManagerPtr = mockSubscriptionManagerPtr.get();
|
||||
EXPECT_CALL(*rawSubscriptionManagerPtr, unsubProposedAccount(rpc::accountFromStringStrict(ACCOUNT).value(), _))
|
||||
@@ -596,7 +596,8 @@ TEST_F(RPCUnsubscribeTest, Books)
|
||||
}}
|
||||
]
|
||||
}})",
|
||||
ACCOUNT));
|
||||
ACCOUNT
|
||||
));
|
||||
|
||||
auto const parsedBookMaybe = rpc::parseBook(input.as_object().at("books").as_array()[0].as_object());
|
||||
auto const book = std::get<ripple::Book>(parsedBookMaybe);
|
||||
@@ -629,7 +630,8 @@ TEST_F(RPCUnsubscribeTest, SingleBooks)
|
||||
}}
|
||||
]
|
||||
}})",
|
||||
ACCOUNT));
|
||||
ACCOUNT
|
||||
));
|
||||
|
||||
auto const parsedBookMaybe = rpc::parseBook(input.as_object().at("books").as_array()[0].as_object());
|
||||
auto const book = std::get<ripple::Book>(parsedBookMaybe);
|
||||
|
||||
Reference in New Issue
Block a user