diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-03-15 16:51:55 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-03-15 16:51:55 +0100 |
commit | dd240d06dc35c50239dec91dcf043f8d4c990953 (patch) | |
tree | af968c6c61b30ac6b383ac8e92f5bef81f71933d /accounts/maildir/tests/settingstest.cpp | |
parent | 8318b29b81d9a98fc5ad5fe1550f6d7a46ca7296 (diff) | |
download | kube-dd240d06dc35c50239dec91dcf043f8d4c990953.tar.gz kube-dd240d06dc35c50239dec91dcf043f8d4c990953.zip |
Fixed and tested maildirsettings.
Diffstat (limited to 'accounts/maildir/tests/settingstest.cpp')
-rw-r--r-- | accounts/maildir/tests/settingstest.cpp | 42 |
1 files changed, 34 insertions, 8 deletions
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 @@ | |||
1 | #include <QtTest> | 1 | #include <QTest> |
2 | #include <QDebug> | 2 | #include <QDebug> |
3 | #include <QSignalSpy> | ||
3 | #include <functional> | 4 | #include <functional> |
5 | #include <QStandardPaths> | ||
6 | #include <QDir> | ||
7 | #include <sink/test.h> | ||
8 | #include <sink/store.h> | ||
4 | 9 | ||
5 | #include "maildirsettings.h" | 10 | #include "maildirsettings.h" |
6 | 11 | ||
@@ -11,9 +16,7 @@ private slots: | |||
11 | 16 | ||
12 | void initTestCase() | 17 | void initTestCase() |
13 | { | 18 | { |
14 | // Sink::FacadeFactory::instance().resetFactory(); | 19 | Sink::Test::initTest(); |
15 | // ResourceConfig::clear(); | ||
16 | // Sink::Log::setDebugOutputLevel(Sink::Log::Trace); | ||
17 | } | 20 | } |
18 | 21 | ||
19 | void testLoad() | 22 | void testLoad() |
@@ -26,10 +29,33 @@ private slots: | |||
26 | settings.setPath(maildirPath); | 29 | settings.setPath(maildirPath); |
27 | settings.save(); | 30 | settings.save(); |
28 | 31 | ||
29 | //TODO ensure the maildir resource has been created | 32 | Sink::Store::fetchAll<Sink::ApplicationDomain::SinkResource>(Sink::Query()).then<void, QList<Sink::ApplicationDomain::SinkResource>>([](const QList<Sink::ApplicationDomain::SinkResource> &resources) { |
30 | //TODO ensure the path has been setup correctly | 33 | QCOMPARE(resources.size(), 1); |
31 | //Ensure we can read the configuration correctly | 34 | }) |
32 | //Ensure we can remove the account again | 35 | .exec().waitForFinished(); |
36 | |||
37 | //Ensure we can read back all the information using the accountid | ||
38 | { | ||
39 | MaildirSettings readSettings; | ||
40 | QSignalSpy spy(&readSettings, &MaildirSettings::pathChanged); | ||
41 | readSettings.setAccountIdentifier(accountId); | ||
42 | QTRY_VERIFY(spy.count()); | ||
43 | QVERIFY(!readSettings.identifier().isEmpty()); | ||
44 | QCOMPARE(readSettings.path().toString(), maildirPath); | ||
45 | } | ||
46 | |||
47 | { | ||
48 | MaildirSettings settings; | ||
49 | QSignalSpy spy(&settings, &MaildirSettings::pathChanged); | ||
50 | settings.setAccountIdentifier(accountId); | ||
51 | QTRY_VERIFY(spy.count()); | ||
52 | settings.remove(); | ||
53 | } | ||
54 | |||
55 | Sink::Store::fetchAll<Sink::ApplicationDomain::SinkResource>(Sink::Query()).then<void, QList<Sink::ApplicationDomain::SinkResource>>([](const QList<Sink::ApplicationDomain::SinkResource> &resources) { | ||
56 | QCOMPARE(resources.size(), 0); | ||
57 | }) | ||
58 | .exec().waitForFinished(); | ||
33 | } | 59 | } |
34 | }; | 60 | }; |
35 | 61 | ||