Remove "strict" (#755)

Fixes #756
This commit is contained in:
cyan317
2023-07-11 13:21:56 +01:00
committed by GitHub
parent 7710468f37
commit e79425bc21
8 changed files with 4 additions and 59 deletions

View File

@@ -72,9 +72,7 @@ public:
static auto const rpcSpec = RpcSpec{ static auto const rpcSpec = RpcSpec{
{JS(account), validation::Required{}, validation::AccountValidator}, {JS(account), validation::Required{}, validation::AccountValidator},
{JS(ledger_hash), validation::Uint256HexStringValidator}, {JS(ledger_hash), validation::Uint256HexStringValidator},
{JS(ledger_index), validation::LedgerIndexValidator}, {JS(ledger_index), validation::LedgerIndexValidator}};
{JS(strict), meta::IfType<bool>{validation::NotSupported{false}}},
};
return rpcSpec; return rpcSpec;
} }

View File

@@ -90,9 +90,7 @@ public:
{JS(ident), validation::AccountValidator}, {JS(ident), validation::AccountValidator},
{JS(ledger_hash), validation::Uint256HexStringValidator}, {JS(ledger_hash), validation::Uint256HexStringValidator},
{JS(ledger_index), validation::LedgerIndexValidator}, {JS(ledger_index), validation::LedgerIndexValidator},
{JS(signer_lists), validation::Type<bool>{}}, {JS(signer_lists), validation::Type<bool>{}}};
{JS(strict), meta::IfType<bool>{validation::NotSupported{false}}},
};
return rpcSpec; return rpcSpec;
} }

View File

@@ -84,9 +84,7 @@ public:
{JS(ledger_hash), validation::Uint256HexStringValidator}, {JS(ledger_hash), validation::Uint256HexStringValidator},
{JS(ledger_index), validation::LedgerIndexValidator}, {JS(ledger_index), validation::LedgerIndexValidator},
{JS(marker), validation::AccountMarkerValidator}, {JS(marker), validation::AccountMarkerValidator},
{JS(limit), validation::Type<uint32_t>{}, modifiers::Clamp<int32_t>{10, 400}}, {JS(limit), validation::Type<uint32_t>{}, modifiers::Clamp<int32_t>{10, 400}}};
{JS(strict), meta::IfType<bool>{validation::NotSupported{false}}},
};
return rpcSpec; return rpcSpec;
} }

View File

@@ -106,9 +106,7 @@ public:
{JS(account), validation::Required{}, validation::AccountValidator}, {JS(account), validation::Required{}, validation::AccountValidator},
{JS(ledger_hash), validation::Uint256HexStringValidator}, {JS(ledger_hash), validation::Uint256HexStringValidator},
{JS(ledger_index), validation::LedgerIndexValidator}, {JS(ledger_index), validation::LedgerIndexValidator},
{JS(hotwallet), hotWalletValidator}, {JS(hotwallet), hotWalletValidator}};
{JS(strict), meta::IfType<bool>{validation::NotSupported{false}}},
};
return rpcSpec; return rpcSpec;
} }

View File

@@ -40,30 +40,6 @@ class RPCAccountCurrenciesHandlerTest : public HandlerBaseTest
{ {
}; };
TEST_F(RPCAccountCurrenciesHandlerTest, StrictSetToFalseUnsupported)
{
mockBackendPtr->updateRange(10); // min
mockBackendPtr->updateRange(30); // max
auto const static input = boost::json::parse(fmt::format(
R"({{
"account": "{}",
"strict": false
}})",
ACCOUNT));
auto const handler = AnyHandler{AccountCurrenciesHandler{mockBackendPtr}};
runSpawn([&](auto& yield) {
auto const output = handler.process(input, Context{std::ref(yield)});
ASSERT_FALSE(output);
auto const err = RPC::makeError(output.error());
EXPECT_EQ(err.at("error").as_string(), "notSupported");
EXPECT_EQ(err.at("error_message").as_string(), "Not supported field 'strict's value 'false'");
});
}
TEST_F(RPCAccountCurrenciesHandlerTest, AccountNotExist) TEST_F(RPCAccountCurrenciesHandlerTest, AccountNotExist)
{ {
auto const rawBackendPtr = static_cast<MockBackend*>(mockBackendPtr.get()); auto const rawBackendPtr = static_cast<MockBackend*>(mockBackendPtr.get());

View File

@@ -91,11 +91,6 @@ generateTestValuesForParametersTest()
R"({"ident":"rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun", "ledger_index":"a"})", R"({"ident":"rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun", "ledger_index":"a"})",
"invalidParams", "invalidParams",
"ledgerIndexMalformed"}, "ledgerIndexMalformed"},
AccountInfoParamTestCaseBundle{
"StrictFieldUnsupportedValue",
R"({"ident": "rLEsXccBGNR3UPuPu2hUXPjziKC3qKSBun", "strict": false})",
"notSupported",
"Not supported field 'strict's value 'false'"},
}; };
} }

View File

@@ -119,12 +119,6 @@ generateTestValuesForParametersTest()
"invalidParams", "invalidParams",
"Malformed cursor.", "Malformed cursor.",
}, },
{
"StrictFieldUnsupportedValue",
R"({"account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn", "strict": false})",
"notSupported",
"Not supported field 'strict's value 'false'",
},
}; };
} }

View File

@@ -170,18 +170,6 @@ generateParameterTestBundles()
ACCOUNT), ACCOUNT),
"invalidParams", "invalidParams",
"hotwalletMalformed"}, "hotwalletMalformed"},
ParameterTestBundle{
"StrictFieldUnsupportedValue",
fmt::format(
R"({{
"account": "{}",
"hotwallet": "{}",
"strict": false
}})",
ACCOUNT,
ACCOUNT2),
"notSupported",
"Not supported field 'strict's value 'false'"},
}; };
} }