mirror of
https://github.com/XRPLF/clio.git
synced 2025-12-01 09:05:51 +00:00
feat: Integrate new webserver (#1722)
For #919. The new web server is not using dosguard yet. It will be fixed by a separate PR.
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "feed/FeedTestUtil.hpp"
|
||||
#include "feed/impl/ForwardFeed.hpp"
|
||||
#include "util/async/AnyExecutionContext.hpp"
|
||||
#include "web/SubscriptionContextInterface.hpp"
|
||||
|
||||
#include <boost/json/parse.hpp>
|
||||
#include <gmock/gmock.h>
|
||||
@@ -44,11 +45,14 @@ using FeedForwardTest = FeedBaseTest<NamedForwardFeedTest>;
|
||||
|
||||
TEST_F(FeedForwardTest, Pub)
|
||||
{
|
||||
EXPECT_CALL(*mockSessionPtr, onDisconnect);
|
||||
testFeedPtr->sub(sessionPtr);
|
||||
EXPECT_EQ(testFeedPtr->count(), 1);
|
||||
|
||||
auto const json = json::parse(FEED).as_object();
|
||||
EXPECT_CALL(*mockSessionPtr, send(SharedStringJsonEq(FEED))).Times(1);
|
||||
testFeedPtr->pub(json);
|
||||
|
||||
testFeedPtr->unsub(sessionPtr);
|
||||
EXPECT_EQ(testFeedPtr->count(), 0);
|
||||
testFeedPtr->pub(json);
|
||||
@@ -56,12 +60,18 @@ TEST_F(FeedForwardTest, Pub)
|
||||
|
||||
TEST_F(FeedForwardTest, AutoDisconnect)
|
||||
{
|
||||
web::SubscriptionContextInterface::OnDisconnectSlot slot;
|
||||
EXPECT_CALL(*mockSessionPtr, onDisconnect).WillOnce(testing::SaveArg<0>(&slot));
|
||||
testFeedPtr->sub(sessionPtr);
|
||||
EXPECT_EQ(testFeedPtr->count(), 1);
|
||||
|
||||
auto const json = json::parse(FEED).as_object();
|
||||
EXPECT_CALL(*mockSessionPtr, send(SharedStringJsonEq(FEED))).Times(1);
|
||||
EXPECT_CALL(*mockSessionPtr, send(SharedStringJsonEq(FEED)));
|
||||
testFeedPtr->pub(json);
|
||||
|
||||
slot(sessionPtr.get());
|
||||
sessionPtr.reset();
|
||||
EXPECT_EQ(testFeedPtr->count(), 0);
|
||||
|
||||
testFeedPtr->pub(json);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user