diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-01-04 19:46:34 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-01-04 19:46:34 +0000 |
commit | dcf0c906a22e7f23495ee8fe5c30c2d1870f7639 (patch) | |
tree | 666533e14c2fdca28df953a3d060b9aa592ee050 /libodbcpp/unittests | |
parent | Fix error message creation in exception (diff) | |
download | libdbpp-odbc-1.0.1.tar.bz2 libdbpp-odbc-1.0.1.tar.xz libdbpp-odbc-1.0.1.zip |
Take an extra argument to mock to allow for specifying which driver to use, etc. Move all the PostgreSQL specific bits into the unit test itself. Reference the driver library by filename thus not requiring configuration for the test to run.libdbpp-odbc-1.0.1
Diffstat (limited to 'libodbcpp/unittests')
-rw-r--r-- | libodbcpp/unittests/testodbc.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libodbcpp/unittests/testodbc.cpp b/libodbcpp/unittests/testodbc.cpp index f288bf8..77f0a71 100644 --- a/libodbcpp/unittests/testodbc.cpp +++ b/libodbcpp/unittests/testodbc.cpp @@ -13,10 +13,16 @@ class StandardMockDatabase : public ODBC::Mock { public: - StandardMockDatabase() : ODBC::Mock("Driver=postgresql;Database=postgres;uid=postgres;servername=/run/postgresql", "odbcmock", { + StandardMockDatabase() : ODBC::Mock("Driver=psqlodbcw.so;uid=postgres;servername=/run/postgresql", "Database=postgres", "odbcmock", { rootDir / "odbcschema.sql" }) { } + + void DropDatabase() const override + { + master->execute("SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = '" + testDbName + "'"); + ODBC::Mock::DropDatabase(); + } }; BOOST_GLOBAL_FIXTURE( StandardMockDatabase ); |