summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Jamfile.jam6
-rw-r--r--test/test-ingest.cpp17
2 files changed, 23 insertions, 0 deletions
diff --git a/test/Jamfile.jam b/test/Jamfile.jam
index a008606..8460cef 100644
--- a/test/Jamfile.jam
+++ b/test/Jamfile.jam
@@ -1,14 +1,20 @@
lib boost_unit_test_framework : : <link>shared ;
+lib dbpptestcore : : <link>shared ;
+lib stdc++fs ;
path-constant src : ../src ;
path-constant test : . ;
run test-ingest.cpp :
-- :
+ ../src/schema.sql
:
<define>BOOST_TEST_DYN_LINK
<define>SRC=\"$(src)\"
<define>TEST=\"$(test)\"
<library>$(src)//webstat
+ <library>..//dbpp-postgresql
<library>boost_unit_test_framework
+ <library>dbpptestcore
+ <library>stdc++fs
;
diff --git a/test/test-ingest.cpp b/test/test-ingest.cpp
index 0bbeeae..af063f3 100644
--- a/test/test-ingest.cpp
+++ b/test/test-ingest.cpp
@@ -2,7 +2,24 @@
#include <boost/test/data/test_case.hpp>
#include <boost/test/unit_test.hpp>
+#include <dbpp-postgresql/pq-mock.h>
+#include <filesystem>
#include <ingestor.hpp>
+#include <mockDatabase.h>
+
+#define XSTR(s) STR(s)
+#define STR(s) #s
+const std::filesystem::path SRC_DIR(XSTR(SRC));
+const std::filesystem::path TEST_DIR(XSTR(TEST));
+#undef XSTR
+#undef STR
+
+class Mock : public DB::PluginMock<PQ::Mock> {
+public:
+ Mock() : DB::PluginMock<PQ::Mock>("webstat", {SRC_DIR / "schema.sql"}, "user=postgres dbname=postgres") { }
+};
+
+BOOST_GLOBAL_FIXTURE(Mock);
using ScanValues = std::remove_cvref_t<decltype(std::declval<WebStat::Ingestor::ScanResult>()->values())>;
template<typename Out> using ParseData = std::tuple<std::string_view, Out>;