diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-03-01 00:39:57 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-03-01 00:39:57 +0000 |
commit | eb526b1ba4e69fe2fc1e741dbbe6809fbb8b2feb (patch) | |
tree | 49387b38c4e44961c4f0069579f551fa94976702 | |
parent | Don't require lots of casting to mock mail server (diff) | |
download | gentoobrowse-api-eb526b1ba4e69fe2fc1e741dbbe6809fbb8b2feb.tar.bz2 gentoobrowse-api-eb526b1ba4e69fe2fc1e741dbbe6809fbb8b2feb.tar.xz gentoobrowse-api-eb526b1ba4e69fe2fc1e741dbbe6809fbb8b2feb.zip |
Clear sent emails on fixture exit
-rw-r--r-- | gentoobrowse-api/unittests/mockDefs.cpp | 7 | ||||
-rw-r--r-- | gentoobrowse-api/unittests/mockDefs.h | 4 | ||||
-rw-r--r-- | gentoobrowse-api/unittests/testUsers.cpp | 2 |
3 files changed, 12 insertions, 1 deletions
diff --git a/gentoobrowse-api/unittests/mockDefs.cpp b/gentoobrowse-api/unittests/mockDefs.cpp index 7f78b9d..883f84d 100644 --- a/gentoobrowse-api/unittests/mockDefs.cpp +++ b/gentoobrowse-api/unittests/mockDefs.cpp @@ -68,6 +68,13 @@ TestClient::TestClient() : BOOST_REQUIRE(u); } +TestClient::~TestClient() +{ + if (mms) { + mms->clear(); + } +} + std::array<IceTray::Mime::TextPart *, 2> TestClient::humanReadableParts(const IceTray::Mail::EmailPtr & e) const { diff --git a/gentoobrowse-api/unittests/mockDefs.h b/gentoobrowse-api/unittests/mockDefs.h index 404b2a2..8284f11 100644 --- a/gentoobrowse-api/unittests/mockDefs.h +++ b/gentoobrowse-api/unittests/mockDefs.h @@ -3,6 +3,7 @@ #include <array> #include <boost/test/unit_test.hpp> +#include <c++11Helpers.h> #include <command_fwd.h> #include <connection.h> #include <connection_fwd.h> @@ -49,6 +50,9 @@ public: class DLL_PUBLIC TestClient : public IceTray::DryIceClient { public: TestClient(); + ~TestClient(); + + SPECIAL_MEMBERS_DELETE(TestClient); Gentoo::MaintenancePrxPtr m; Gentoo::PortagePrxPtr p; diff --git a/gentoobrowse-api/unittests/testUsers.cpp b/gentoobrowse-api/unittests/testUsers.cpp index 0f5ee9c..4af063b 100644 --- a/gentoobrowse-api/unittests/testUsers.cpp +++ b/gentoobrowse-api/unittests/testUsers.cpp @@ -116,7 +116,7 @@ BOOST_AUTO_TEST_CASE(createAgain) * * resend verification */ auto user = u->create("testuser", "testpass", "Test User", "recreate@user.com"); - BOOST_REQUIRE_EQUAL(2, mms->getSentEmails().size()); + BOOST_REQUIRE_EQUAL(1, mms->getSentEmails().size()); BOOST_REQUIRE_EQUAL("Gentoo Browse: Welcome", mms->getSentEmails()[0]->subject); BOOST_REQUIRE_EQUAL("test@user.com", mms->getSentEmails()[0]->to.address); BOOST_REQUIRE_EQUAL(4, user->userid); |