#ifndef MOCKDEFS_H #define MOCKDEFS_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace IceTray::Mime { class TextPart; } namespace PQ { class Mock; } class DLL_PUBLIC DbAlias { public: DbAlias(); virtual ~DbAlias(); }; class DLL_PUBLIC Service : public IceTray::DryIce, DB::PluginMock, DbAlias { public: Service(); }; class DLL_PUBLIC Maintenance : public IceTray::DryIce, DB::PluginMock, DbAlias { public: Maintenance(); }; class DLL_PUBLIC Mail : public IceTray::DryIce { public: Mail(); }; class DLL_PUBLIC TestClient : public IceTray::DryIceClient { public: TestClient(); ~TestClient(); SPECIAL_MEMBERS_DELETE(TestClient); Gentoo::MaintenancePrxPtr m; Gentoo::PortagePrxPtr p; Gentoo::NotificationsPtr n; IceTray::Mail::MailServerPtr ms; IceTray::Mail::MockMailServerPtr mms; Gentoo::UsersPrxPtr u; void lintable_test_files(std::string_view name, const IceTray::Mail::EmailPtr & e) const; std::array humanReadableParts(const IceTray::Mail::EmailPtr & e) const; }; #define SQL_REQUIRE_EQUAL(sql, type, expected) \ BOOST_TEST_CONTEXT(sql) { \ sqlRequireEqual(db, sql, expected); \ } template void sqlRequireEqual(DB::ConnectionPtr db, const char * const sql, const T & expected) { int assertedRows = 0; db->select(sql)->forEachRow([expected, &assertedRows](const auto & n) { BOOST_REQUIRE_EQUAL(expected, n); assertedRows += 1; }); BOOST_REQUIRE_EQUAL(assertedRows, 1); } #endif