diff options
-rw-r--r-- | gentoobrowse-api/unittests/Jamfile.jam | 1 | ||||
-rw-r--r-- | gentoobrowse-api/unittests/mockDefs.h | 7 | ||||
-rw-r--r-- | gentoobrowse-api/unittests/testMaintenance.cpp | 4 |
3 files changed, 8 insertions, 4 deletions
diff --git a/gentoobrowse-api/unittests/Jamfile.jam b/gentoobrowse-api/unittests/Jamfile.jam index 9f60eb4..1876d46 100644 --- a/gentoobrowse-api/unittests/Jamfile.jam +++ b/gentoobrowse-api/unittests/Jamfile.jam @@ -30,6 +30,7 @@ lib testCommon : <library>..//IceBox <library>dryice <library>../service//gentoobrowse-service + <library>boost_utf : : <library>dbpp-postgresql <library>..//dbppcore diff --git a/gentoobrowse-api/unittests/mockDefs.h b/gentoobrowse-api/unittests/mockDefs.h index 586079f..d69d3e1 100644 --- a/gentoobrowse-api/unittests/mockDefs.h +++ b/gentoobrowse-api/unittests/mockDefs.h @@ -10,7 +10,7 @@ #include <notifications.h> #include <mocks.h> #include <selectcommandUtil.impl.h> -#include <boost/test/tools/context.hpp> +#include <boost/test/unit_test.hpp> class MockMailServerImpl : public Gentoo::MockMailServer { public: @@ -50,9 +50,12 @@ class DLL_PUBLIC TestClient : public IceTray::DryIceClient { #define SQL_REQUIRE_EQUAL(sql, type, expected) BOOST_TEST_CONTEXT(sql) { sqlRequireEqual<type>(db, sql, expected); } template<typename T> void sqlRequireEqual(DB::ConnectionPtr db, const char * const sql, const T & expected) { - db->select(sql)->forEachRow<T>([expected](const auto & n) { + int assertedRows = 0; + db->select(sql)->forEachRow<T>([expected,&assertedRows](const auto & n) { BOOST_REQUIRE_EQUAL(expected, n); + assertedRows += 1; }); + BOOST_REQUIRE_EQUAL(assertedRows, 1); } #endif diff --git a/gentoobrowse-api/unittests/testMaintenance.cpp b/gentoobrowse-api/unittests/testMaintenance.cpp index 26272d1..eab8090 100644 --- a/gentoobrowse-api/unittests/testMaintenance.cpp +++ b/gentoobrowse-api/unittests/testMaintenance.cpp @@ -205,9 +205,9 @@ BOOST_AUTO_TEST_CASE( testRefreshGitRepository ) } BOOST_TEST_CONTEXT("And it maintained its original packageId, but changed categoryId") { SQL_REQUIRE_EQUAL(R"SQL(SELECT p.packageid FROM gentoobrowse.categories c, gentoobrowse.packages p - WHERE c.categoryid = p.categoryid AND p.name = 'libkgapi' AND c.name='net-libs')SQL", int64_t, 9); + WHERE c.categoryid = p.categoryid AND p.name = 'libkgapi' AND c.name='kde-apps')SQL", int64_t, 9); SQL_REQUIRE_EQUAL(R"SQL(SELECT p.categoryid FROM gentoobrowse.categories c, gentoobrowse.packages p - WHERE c.categoryid = p.categoryid AND p.name = 'libkgapi' AND c.name='net-libs')SQL", int64_t, 8); + WHERE c.categoryid = p.categoryid AND p.name = 'libkgapi' AND c.name='kde-apps')SQL", int64_t, 8); } BOOST_TEST_CONTEXT("Original ebuilds in moved package were not deleted and replaced") { SQL_REQUIRE_EQUAL(R"SQL(SELECT COUNT(*) FROM gentoobrowse.ebuilds e WHERE e.packageid = 9)SQL", int64_t, 2); |