diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2025-08-23 15:34:51 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2025-08-25 16:01:17 +0100 |
commit | d0fe9fe6c613ec8894ca4b1d330e7847845a4710 (patch) | |
tree | 60abb970345fcb9e8808c7aee3134bd976775071 /test/test-ingest.cpp | |
parent | faff88728dc925a08515f96236cab62bb70110e5 (diff) | |
download | webstat-d0fe9fe6c613ec8894ca4b1d330e7847845a4710.tar.bz2 webstat-d0fe9fe6c613ec8894ca4b1d330e7847845a4710.tar.xz webstat-d0fe9fe6c613ec8894ca4b1d330e7847845a4710.zip |
Add DB schema and setup a mock of it in testing
Diffstat (limited to 'test/test-ingest.cpp')
-rw-r--r-- | test/test-ingest.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
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>; |