From dd240d06dc35c50239dec91dcf043f8d4c990953 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 15 Mar 2016 16:51:55 +0100 Subject: Fixed and tested maildirsettings. --- accounts/maildir/tests/settingstest.cpp | 42 ++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 8 deletions(-) (limited to 'accounts/maildir/tests') diff --git a/accounts/maildir/tests/settingstest.cpp b/accounts/maildir/tests/settingstest.cpp index d9983028..af1a35b4 100644 --- a/accounts/maildir/tests/settingstest.cpp +++ b/accounts/maildir/tests/settingstest.cpp @@ -1,6 +1,11 @@ -#include +#include #include +#include #include +#include +#include +#include +#include #include "maildirsettings.h" @@ -11,9 +16,7 @@ private slots: void initTestCase() { - // Sink::FacadeFactory::instance().resetFactory(); - // ResourceConfig::clear(); - // Sink::Log::setDebugOutputLevel(Sink::Log::Trace); + Sink::Test::initTest(); } void testLoad() @@ -26,10 +29,33 @@ private slots: settings.setPath(maildirPath); settings.save(); - //TODO ensure the maildir resource has been created - //TODO ensure the path has been setup correctly - //Ensure we can read the configuration correctly - //Ensure we can remove the account again + Sink::Store::fetchAll(Sink::Query()).then>([](const QList &resources) { + QCOMPARE(resources.size(), 1); + }) + .exec().waitForFinished(); + + //Ensure we can read back all the information using the accountid + { + MaildirSettings readSettings; + QSignalSpy spy(&readSettings, &MaildirSettings::pathChanged); + readSettings.setAccountIdentifier(accountId); + QTRY_VERIFY(spy.count()); + QVERIFY(!readSettings.identifier().isEmpty()); + QCOMPARE(readSettings.path().toString(), maildirPath); + } + + { + MaildirSettings settings; + QSignalSpy spy(&settings, &MaildirSettings::pathChanged); + settings.setAccountIdentifier(accountId); + QTRY_VERIFY(spy.count()); + settings.remove(); + } + + Sink::Store::fetchAll(Sink::Query()).then>([](const QList &resources) { + QCOMPARE(resources.size(), 0); + }) + .exec().waitForFinished(); } }; -- cgit v1.2.3