snake: stream sql mock + add republished channel option

This commit is contained in:
Benjamin Sergeant
2020-07-10 15:06:55 -07:00
parent c98959b895
commit 26a1e63626
11 changed files with 102 additions and 4 deletions

View File

@ -57,6 +57,7 @@ set (SOURCES
IXWebSocketChatTest.cpp
IXWebSocketBroadcastTest.cpp
IXWebSocketPerMessageDeflateCompressorTest.cpp
IXStreamSqlTest.cpp
)
# Some unittest don't work on windows yet

32
test/IXStreamSqlTest.cpp Normal file
View File

@ -0,0 +1,32 @@
/*
* IXStreamSqlTest.cpp
* Author: Benjamin Sergeant
* Copyright (c) 2020 Machine Zone. All rights reserved.
*/
#include "IXTest.h"
#include "catch.hpp"
#include <iostream>
#include <ixsnake/IXStreamSql.h>
#include <string.h>
using namespace ix;
namespace ix
{
TEST_CASE("stream_sql", "[streamsql]")
{
SECTION("expression A")
{
snake::StreamSql streamSql("select * from subscriber_republished_v1_neo where session LIKE '%{self.session_id}%'");
nlohmann::json msg = {
{"action", "auth/authenticate/error"},
{"id", 1},
{"body", {{"error", "authentication_failed"}, {"reason", "invalid secret"}}}};
REQUIRE(streamSql.match(msg));
}
}
} // namespace ix