mirror of
https://github.com/XRPLF/clio.git
synced 2025-12-06 17:27:58 +00:00
@@ -50,7 +50,6 @@ TEST_F(CliArgsTests, Parse_NoArgs)
|
||||
int const returnCode = 123;
|
||||
EXPECT_CALL(onRunMock, Call).WillOnce([](CliArgs::Action::Run const& run) {
|
||||
EXPECT_EQ(run.configPath, CliArgs::kDEFAULT_CONFIG_PATH);
|
||||
EXPECT_FALSE(run.useNgWebServer);
|
||||
return returnCode;
|
||||
});
|
||||
EXPECT_EQ(
|
||||
@@ -64,29 +63,6 @@ TEST_F(CliArgsTests, Parse_NoArgs)
|
||||
);
|
||||
}
|
||||
|
||||
TEST_F(CliArgsTests, Parse_NgWebServer)
|
||||
{
|
||||
for (auto& argv : {std::array{"clio_server", "-w"}, std::array{"clio_server", "--ng-web-server"}}) {
|
||||
auto const action = CliArgs::parse(argv.size(), const_cast<char const**>(argv.data()));
|
||||
|
||||
int const returnCode = 123;
|
||||
EXPECT_CALL(onRunMock, Call).WillOnce([](CliArgs::Action::Run const& run) {
|
||||
EXPECT_EQ(run.configPath, CliArgs::kDEFAULT_CONFIG_PATH);
|
||||
EXPECT_TRUE(run.useNgWebServer);
|
||||
return returnCode;
|
||||
});
|
||||
EXPECT_EQ(
|
||||
action.apply(
|
||||
onRunMock.AsStdFunction(),
|
||||
onExitMock.AsStdFunction(),
|
||||
onMigrateMock.AsStdFunction(),
|
||||
onVerifyMock.AsStdFunction()
|
||||
),
|
||||
returnCode
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(CliArgsTests, Parse_VersionHelp)
|
||||
{
|
||||
for (auto& argv :
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "util/MockPrometheus.hpp"
|
||||
#include "util/MockSubscriptionManager.hpp"
|
||||
#include "util/config/ConfigDefinition.hpp"
|
||||
#include "web/ng/Server.hpp"
|
||||
#include "web/Server.hpp"
|
||||
|
||||
#include <boost/asio/executor_work_guard.hpp>
|
||||
#include <boost/asio/io_context.hpp>
|
||||
@@ -62,7 +62,7 @@ TEST_F(StopperTest, stopCalledMultipleTimes)
|
||||
}
|
||||
|
||||
struct StopperMakeCallbackTest : util::prometheus::WithPrometheus, SyncAsioContextTest {
|
||||
struct ServerMock : web::ng::ServerTag {
|
||||
struct ServerMock : web::ServerTag {
|
||||
MOCK_METHOD(void, stop, (boost::asio::yield_context), ());
|
||||
};
|
||||
|
||||
|
||||
@@ -27,12 +27,12 @@
|
||||
#include "util/config/ConfigValue.hpp"
|
||||
#include "util/config/Types.hpp"
|
||||
#include "web/AdminVerificationStrategy.hpp"
|
||||
#include "web/Connection.hpp"
|
||||
#include "web/MockConnection.hpp"
|
||||
#include "web/Request.hpp"
|
||||
#include "web/Response.hpp"
|
||||
#include "web/SubscriptionContextInterface.hpp"
|
||||
#include "web/dosguard/DOSGuardMock.hpp"
|
||||
#include "web/ng/Connection.hpp"
|
||||
#include "web/ng/MockConnection.hpp"
|
||||
#include "web/ng/Request.hpp"
|
||||
#include "web/ng/Response.hpp"
|
||||
|
||||
#include <boost/asio/spawn.hpp>
|
||||
#include <boost/beast/core/flat_buffer.hpp>
|
||||
@@ -108,7 +108,7 @@ struct MetricsHandlerTests : util::prometheus::WithPrometheus, SyncAsioContextTe
|
||||
};
|
||||
|
||||
MetricsHandler metricsHandler{adminVerifier};
|
||||
web::ng::Request request{http::request<http::string_body>{http::verb::get, "/metrics", 11}};
|
||||
web::Request request{http::request<http::string_body>{http::verb::get, "/metrics", 11}};
|
||||
};
|
||||
|
||||
TEST_F(MetricsHandlerTests, Call)
|
||||
@@ -122,7 +122,7 @@ TEST_F(MetricsHandlerTests, Call)
|
||||
}
|
||||
|
||||
struct HealthCheckHandlerTests : SyncAsioContextTest, WebHandlersTest {
|
||||
web::ng::Request request{http::request<http::string_body>{http::verb::get, "/", 11}};
|
||||
web::Request request{http::request<http::string_body>{http::verb::get, "/", 11}};
|
||||
HealthCheckHandler healthCheckHandler;
|
||||
};
|
||||
|
||||
@@ -142,19 +142,19 @@ struct RequestHandlerTest : SyncAsioContextTest, WebHandlersTest {
|
||||
|
||||
struct RpcHandlerMock {
|
||||
MOCK_METHOD(
|
||||
web::ng::Response,
|
||||
web::Response,
|
||||
call,
|
||||
(web::ng::Request const&,
|
||||
web::ng::ConnectionMetadata const&,
|
||||
(web::Request const&,
|
||||
web::ConnectionMetadata const&,
|
||||
web::SubscriptionContextPtr,
|
||||
boost::asio::yield_context),
|
||||
()
|
||||
);
|
||||
|
||||
web::ng::Response
|
||||
web::Response
|
||||
operator()(
|
||||
web::ng::Request const& request,
|
||||
web::ng::ConnectionMetadata const& connectionMetadata,
|
||||
web::Request const& request,
|
||||
web::ConnectionMetadata const& connectionMetadata,
|
||||
web::SubscriptionContextPtr subscriptionContext,
|
||||
boost::asio::yield_context yield
|
||||
)
|
||||
@@ -170,7 +170,7 @@ struct RequestHandlerTest : SyncAsioContextTest, WebHandlersTest {
|
||||
|
||||
TEST_F(RequestHandlerTest, RpcHandlerThrows)
|
||||
{
|
||||
web::ng::Request const request{http::request<http::string_body>{http::verb::get, "/", 11}};
|
||||
web::Request const request{http::request<http::string_body>{http::verb::get, "/", 11}};
|
||||
|
||||
EXPECT_CALL(*adminVerifier, isAdmin).WillOnce(testing::Return(true));
|
||||
EXPECT_CALL(rpcHandler, call).WillOnce(testing::Throw(std::runtime_error{"some error"}));
|
||||
@@ -191,9 +191,9 @@ TEST_F(RequestHandlerTest, RpcHandlerThrows)
|
||||
|
||||
TEST_F(RequestHandlerTest, NoErrors)
|
||||
{
|
||||
web::ng::Request const request{http::request<http::string_body>{http::verb::get, "/", 11}};
|
||||
web::ng::Response const response{http::status::ok, "some response", request};
|
||||
auto const httpResponse = web::ng::Response{response}.intoHttpResponse();
|
||||
web::Request const request{http::request<http::string_body>{http::verb::get, "/", 11}};
|
||||
web::Response const response{http::status::ok, "some response", request};
|
||||
auto const httpResponse = web::Response{response}.intoHttpResponse();
|
||||
|
||||
EXPECT_CALL(*adminVerifier, isAdmin).WillOnce(testing::Return(true));
|
||||
EXPECT_CALL(rpcHandler, call).WillOnce(testing::Return(response));
|
||||
|
||||
Reference in New Issue
Block a user