summaryrefslogtreecommitdiff
path: root/test/test-ingest.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2025-09-04 20:13:20 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2025-09-04 20:13:20 +0100
commitfdab57f966a3928852701a2e41d75499f8f828ac (patch)
treed6803666d981e6fc3bd9acc65d6a14e3a55af823 /test/test-ingest.cpp
parent421e9aa1f92b21eb1fc3a98b77a2a181afd7180e (diff)
downloadwebstat-fdab57f966a3928852701a2e41d75499f8f828ac.tar.bz2
webstat-fdab57f966a3928852701a2e41d75499f8f828ac.tar.xz
webstat-fdab57f966a3928852701a2e41d75499f8f828ac.zip
Add function to grab UA details from useragentstring.com
Diffstat (limited to 'test/test-ingest.cpp')
-rw-r--r--test/test-ingest.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/test-ingest.cpp b/test/test-ingest.cpp
index 5f29806..1a62b70 100644
--- a/test/test-ingest.cpp
+++ b/test/test-ingest.cpp
@@ -5,6 +5,7 @@
#include "test-util.hpp"
#include <ingestor.hpp>
+#include <uaLookup.hpp>
namespace {
using namespace WebStat;
@@ -181,3 +182,16 @@ BOOST_DATA_TEST_CASE(StoreLogLine,
WebStat::Ingestor {WebStat::getTestUtsName("test-hostname"), std::make_shared<MockDBPool>("webstat")}.ingestLogLine(
DB::MockDatabase::openConnectionTo("webstat").get(), line);
}
+
+BOOST_AUTO_TEST_CASE(FetchRealUserAgentDetail, *boost::unit_test::disabled())
+{
+ const auto uaDetail = WebStat::getUserAgentDetail(
+ R"(Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36)");
+
+ BOOST_TEST_CONTEXT(uaDetail) {
+ BOOST_CHECK(uaDetail.starts_with("{"));
+ BOOST_CHECK(uaDetail.ends_with("}"));
+ BOOST_CHECK(uaDetail.contains(R"("agent_type":)"));
+ BOOST_CHECK(uaDetail.contains(R"("os_type":)"));
+ }
+}