diff options
Diffstat (limited to 'accounts')
-rw-r--r-- | accounts/CMakeLists.txt | 8 | ||||
-rw-r--r-- | accounts/gmail/CMakeLists.txt | 8 | ||||
-rw-r--r-- | accounts/imap/CMakeLists.txt | 12 | ||||
-rw-r--r-- | accounts/imap/tests/CMakeLists.txt | 10 | ||||
-rw-r--r-- | accounts/imap/tests/settingstest.cpp | 120 | ||||
-rw-r--r-- | accounts/kolabnow/CMakeLists.txt | 18 | ||||
-rw-r--r-- | accounts/maildir/CMakeLists.txt | 18 | ||||
-rw-r--r-- | accounts/maildir/tests/CMakeLists.txt | 10 | ||||
-rw-r--r-- | accounts/maildir/tests/settingstest.cpp | 81 |
9 files changed, 9 insertions, 276 deletions
diff --git a/accounts/CMakeLists.txt b/accounts/CMakeLists.txt index ca72f050..e14fda4e 100644 --- a/accounts/CMakeLists.txt +++ b/accounts/CMakeLists.txt | |||
@@ -1,5 +1,13 @@ | |||
1 | include_directories(../framework/src/) | 1 | include_directories(../framework/src/) |
2 | 2 | ||
3 | find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Core Quick Qml) | ||
4 | |||
5 | find_package(Sink CONFIG REQUIRED) | ||
6 | find_package(KAsync CONFIG REQUIRED) | ||
7 | find_package(KF5 REQUIRED COMPONENTS Package Mime) | ||
8 | |||
9 | include_directories(SYSTEM ${KDE_INSTALL_FULL_INCLUDEDIR}/KF5/) | ||
10 | |||
3 | add_subdirectory(maildir) | 11 | add_subdirectory(maildir) |
4 | add_subdirectory(imap) | 12 | add_subdirectory(imap) |
5 | add_subdirectory(kolabnow) | 13 | add_subdirectory(kolabnow) |
diff --git a/accounts/gmail/CMakeLists.txt b/accounts/gmail/CMakeLists.txt index 7a71264f..5be1b134 100644 --- a/accounts/gmail/CMakeLists.txt +++ b/accounts/gmail/CMakeLists.txt | |||
@@ -1,13 +1,5 @@ | |||
1 | project(kube-accounts-gmail) | 1 | project(kube-accounts-gmail) |
2 | 2 | ||
3 | find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui) | ||
4 | |||
5 | find_package(Sink CONFIG REQUIRED) | ||
6 | find_package(KAsync CONFIG REQUIRED) | ||
7 | find_package(KF5 REQUIRED COMPONENTS Package Mime) | ||
8 | |||
9 | include_directories(SYSTEM ${KDE_INSTALL_FULL_INCLUDEDIR}/KF5/) | ||
10 | |||
11 | set(SRCS | 3 | set(SRCS |
12 | gmailsettings.cpp | 4 | gmailsettings.cpp |
13 | gmailaccountplugin.cpp | 5 | gmailaccountplugin.cpp |
diff --git a/accounts/imap/CMakeLists.txt b/accounts/imap/CMakeLists.txt index 5ec32bbc..5bd25a93 100644 --- a/accounts/imap/CMakeLists.txt +++ b/accounts/imap/CMakeLists.txt | |||
@@ -1,6 +1,6 @@ | |||
1 | project(kube-accounts-imap) | 1 | project(kube-accounts-imap) |
2 | 2 | ||
3 | find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Core Concurrent Quick Test Gui) | 3 | find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Core Quick Qml) |
4 | 4 | ||
5 | find_package(Sink CONFIG REQUIRED) | 5 | find_package(Sink CONFIG REQUIRED) |
6 | find_package(KAsync CONFIG REQUIRED) | 6 | find_package(KAsync CONFIG REQUIRED) |
@@ -22,16 +22,6 @@ target_link_libraries(imapaccountplugin | |||
22 | Qt5::Qml | 22 | Qt5::Qml |
23 | ) | 23 | ) |
24 | 24 | ||
25 | add_library(imapaccount_static STATIC ${SRCS}) | ||
26 | target_link_libraries(imapaccount_static | ||
27 | sink | ||
28 | frameworkplugin | ||
29 | Qt5::Core | ||
30 | Qt5::Quick | ||
31 | Qt5::Qml | ||
32 | ) | ||
33 | add_subdirectory(tests) | ||
34 | |||
35 | kpackage_install_package(package org.kube.accounts.imap "genericqml") | 25 | kpackage_install_package(package org.kube.accounts.imap "genericqml") |
36 | 26 | ||
37 | install(TARGETS imapaccountplugin DESTINATION ${QML_INSTALL_DIR}/org/kube/accounts/imap) | 27 | install(TARGETS imapaccountplugin DESTINATION ${QML_INSTALL_DIR}/org/kube/accounts/imap) |
diff --git a/accounts/imap/tests/CMakeLists.txt b/accounts/imap/tests/CMakeLists.txt deleted file mode 100644 index bdfffe4b..00000000 --- a/accounts/imap/tests/CMakeLists.txt +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | include_directories(../) | ||
2 | add_executable(imapsettingstest settingstest.cpp) | ||
3 | add_test(imapsettingstest imapsettingstest) | ||
4 | target_link_libraries(imapsettingstest | ||
5 | sink | ||
6 | imapaccount_static | ||
7 | Qt5::Core | ||
8 | Qt5::Concurrent | ||
9 | Qt5::Test | ||
10 | ) | ||
diff --git a/accounts/imap/tests/settingstest.cpp b/accounts/imap/tests/settingstest.cpp deleted file mode 100644 index 386a9082..00000000 --- a/accounts/imap/tests/settingstest.cpp +++ /dev/null | |||
@@ -1,120 +0,0 @@ | |||
1 | #include <QTest> | ||
2 | #include <QDebug> | ||
3 | #include <QSignalSpy> | ||
4 | #include <functional> | ||
5 | #include <QStandardPaths> | ||
6 | #include <QDir> | ||
7 | #include <sink/test.h> | ||
8 | #include <sink/store.h> | ||
9 | |||
10 | #include "imapsettings.h" | ||
11 | |||
12 | class SettingsTest : public QObject | ||
13 | { | ||
14 | Q_OBJECT | ||
15 | private slots: | ||
16 | |||
17 | void initTestCase() | ||
18 | { | ||
19 | Sink::Test::initTest(); | ||
20 | } | ||
21 | |||
22 | void testLoad() | ||
23 | { | ||
24 | auto accountId = "accountid"; | ||
25 | auto imapServer = QString("imapserver"); | ||
26 | auto imapUsername = QString("imapName"); | ||
27 | auto imapPassword = QString("imapPw"); | ||
28 | auto smtpServer = QString("smtpserver"); | ||
29 | auto smtpUsername = QString("smtpName"); | ||
30 | auto smtpPassword = QString("smtpPw"); | ||
31 | auto username = QString("username"); | ||
32 | auto emailAddress = QString("emailAddress"); | ||
33 | |||
34 | ImapSettings settings; | ||
35 | settings.setAccountIdentifier(accountId); | ||
36 | settings.setProperty("imapServer", imapServer); | ||
37 | settings.setProperty("imapUsername", imapUsername); | ||
38 | settings.setProperty("imapPassword", imapPassword); | ||
39 | settings.setProperty("smtpServer", smtpServer); | ||
40 | settings.setProperty("smtpUsername", smtpUsername); | ||
41 | settings.setProperty("smtpPassword", smtpPassword); | ||
42 | settings.setProperty("userName", username); | ||
43 | settings.setProperty("emailAddress", emailAddress); | ||
44 | settings.save(); | ||
45 | |||
46 | Sink::Store::fetchAll<Sink::ApplicationDomain::SinkResource>(Sink::Query()).then([](const QList<Sink::ApplicationDomain::SinkResource::Ptr> &resources) { | ||
47 | QCOMPARE(resources.size(), 2); | ||
48 | }) | ||
49 | .exec().waitForFinished(); | ||
50 | |||
51 | //Ensure we can read back all the information using the accountid | ||
52 | { | ||
53 | ImapSettings readSettings; | ||
54 | QSignalSpy spy(&readSettings, &ImapSettings::imapResourceChanged); | ||
55 | QSignalSpy spy1(&readSettings, &ImapSettings::smtpResourceChanged); | ||
56 | readSettings.setAccountIdentifier(accountId); | ||
57 | //Once for clear and once for the new setting | ||
58 | QTRY_COMPARE(spy.count(), 2); | ||
59 | QTRY_COMPARE(spy1.count(), 2); | ||
60 | QVERIFY(!readSettings.accountIdentifier().isEmpty()); | ||
61 | QCOMPARE(readSettings.property("imapServer").toString(), imapServer); | ||
62 | QCOMPARE(readSettings.property("imapUsername").toString(), imapUsername); | ||
63 | QCOMPARE(readSettings.property("imapPassword").toString(), imapPassword); | ||
64 | QCOMPARE(readSettings.property("smtpServer").toString(), smtpServer); | ||
65 | QCOMPARE(readSettings.property("smtpUsername").toString(), smtpUsername); | ||
66 | QCOMPARE(readSettings.property("smtpPassword").toString(), smtpPassword); | ||
67 | QCOMPARE(readSettings.property("userName").toString(), username); | ||
68 | QCOMPARE(readSettings.property("emailAddress").toString(), emailAddress); | ||
69 | } | ||
70 | |||
71 | //Modify all settings | ||
72 | { | ||
73 | settings.setProperty("imapServer", imapServer + "mod"); | ||
74 | settings.setProperty("imapUsername", imapUsername + "mod"); | ||
75 | settings.setProperty("imapPassword", imapPassword + "mod"); | ||
76 | settings.setProperty("smtpServer", smtpServer + "mod"); | ||
77 | settings.setProperty("smtpUsername", smtpUsername + "mod"); | ||
78 | settings.setProperty("smtpPassword", smtpPassword + "mod"); | ||
79 | settings.setProperty("userName", username + "mod"); | ||
80 | settings.setProperty("emailAddress", emailAddress + "mod"); | ||
81 | settings.save(); | ||
82 | } | ||
83 | |||
84 | //Read back settings again | ||
85 | { | ||
86 | ImapSettings readSettings; | ||
87 | QSignalSpy spy(&readSettings, &ImapSettings::imapResourceChanged); | ||
88 | QSignalSpy spy1(&readSettings, &ImapSettings::smtpResourceChanged); | ||
89 | readSettings.setAccountIdentifier(accountId); | ||
90 | //Once for clear and once for the new setting | ||
91 | QTRY_COMPARE(spy.count(), 2); | ||
92 | QTRY_COMPARE(spy1.count(), 2); | ||
93 | QVERIFY(!readSettings.accountIdentifier().isEmpty()); | ||
94 | QCOMPARE(readSettings.property("imapServer").toString(), imapServer + "mod"); | ||
95 | QCOMPARE(readSettings.property("imapUsername").toString(), imapUsername + "mod"); | ||
96 | QCOMPARE(readSettings.property("imapPassword").toString(), imapPassword + "mod"); | ||
97 | QCOMPARE(readSettings.property("smtpServer").toString(), smtpServer + "mod"); | ||
98 | QCOMPARE(readSettings.property("smtpUsername").toString(), smtpUsername + "mod"); | ||
99 | QCOMPARE(readSettings.property("smtpPassword").toString(), smtpPassword + "mod"); | ||
100 | QCOMPARE(readSettings.property("userName").toString(), username + "mod"); | ||
101 | QCOMPARE(readSettings.property("emailAddress").toString(), emailAddress + "mod"); | ||
102 | } | ||
103 | |||
104 | { | ||
105 | ImapSettings settings; | ||
106 | QSignalSpy spy(&settings, &ImapSettings::imapResourceChanged); | ||
107 | settings.setAccountIdentifier(accountId); | ||
108 | QTRY_COMPARE(spy.count(), 2); | ||
109 | settings.remove(); | ||
110 | } | ||
111 | |||
112 | Sink::Store::fetchAll<Sink::ApplicationDomain::SinkResource>(Sink::Query()).then([](const QList<Sink::ApplicationDomain::SinkResource::Ptr> &resources) { | ||
113 | QCOMPARE(resources.size(), 0); | ||
114 | }) | ||
115 | .exec().waitForFinished(); | ||
116 | } | ||
117 | }; | ||
118 | |||
119 | QTEST_GUILESS_MAIN(SettingsTest) | ||
120 | #include "settingstest.moc" | ||
diff --git a/accounts/kolabnow/CMakeLists.txt b/accounts/kolabnow/CMakeLists.txt index 8b84d9da..fd168537 100644 --- a/accounts/kolabnow/CMakeLists.txt +++ b/accounts/kolabnow/CMakeLists.txt | |||
@@ -1,13 +1,5 @@ | |||
1 | project(kube-accounts-kolabnow) | 1 | project(kube-accounts-kolabnow) |
2 | 2 | ||
3 | find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui) | ||
4 | |||
5 | find_package(Sink CONFIG REQUIRED) | ||
6 | find_package(KAsync CONFIG REQUIRED) | ||
7 | find_package(KF5 REQUIRED COMPONENTS Package Mime) | ||
8 | |||
9 | include_directories(SYSTEM ${KDE_INSTALL_FULL_INCLUDEDIR}/KF5/) | ||
10 | |||
11 | set(SRCS | 3 | set(SRCS |
12 | kolabnowsettings.cpp | 4 | kolabnowsettings.cpp |
13 | kolabnowaccountplugin.cpp | 5 | kolabnowaccountplugin.cpp |
@@ -22,16 +14,6 @@ target_link_libraries(kolabnowaccountplugin | |||
22 | Qt5::Qml | 14 | Qt5::Qml |
23 | ) | 15 | ) |
24 | 16 | ||
25 | add_library(kolabnowaccount_static STATIC ${SRCS}) | ||
26 | target_link_libraries(kolabnowaccount_static | ||
27 | sink | ||
28 | frameworkplugin | ||
29 | Qt5::Core | ||
30 | Qt5::Quick | ||
31 | Qt5::Qml | ||
32 | ) | ||
33 | # add_subdirectory(tests) | ||
34 | |||
35 | kpackage_install_package(package org.kube.accounts.kolabnow "genericqml") | 17 | kpackage_install_package(package org.kube.accounts.kolabnow "genericqml") |
36 | 18 | ||
37 | install(TARGETS kolabnowaccountplugin DESTINATION ${QML_INSTALL_DIR}/org/kube/accounts/kolabnow) | 19 | install(TARGETS kolabnowaccountplugin DESTINATION ${QML_INSTALL_DIR}/org/kube/accounts/kolabnow) |
diff --git a/accounts/maildir/CMakeLists.txt b/accounts/maildir/CMakeLists.txt index 1b017328..dc0f02fe 100644 --- a/accounts/maildir/CMakeLists.txt +++ b/accounts/maildir/CMakeLists.txt | |||
@@ -1,13 +1,5 @@ | |||
1 | project(kube-accounts-maildir) | 1 | project(kube-accounts-maildir) |
2 | 2 | ||
3 | find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Core Concurrent Quick Test Gui) | ||
4 | |||
5 | find_package(Sink CONFIG REQUIRED) | ||
6 | find_package(KAsync CONFIG REQUIRED) | ||
7 | find_package(KF5 REQUIRED COMPONENTS Package Mime) | ||
8 | |||
9 | include_directories(SYSTEM ${KDE_INSTALL_FULL_INCLUDEDIR}/KF5/) | ||
10 | |||
11 | set(SRCS | 3 | set(SRCS |
12 | maildirsettings.cpp | 4 | maildirsettings.cpp |
13 | maildiraccountplugin.cpp | 5 | maildiraccountplugin.cpp |
@@ -22,16 +14,6 @@ target_link_libraries(maildiraccountplugin | |||
22 | Qt5::Qml | 14 | Qt5::Qml |
23 | ) | 15 | ) |
24 | 16 | ||
25 | add_library(maildiraccount_static STATIC ${SRCS}) | ||
26 | target_link_libraries(maildiraccount_static | ||
27 | sink | ||
28 | frameworkplugin | ||
29 | Qt5::Core | ||
30 | Qt5::Quick | ||
31 | Qt5::Qml | ||
32 | ) | ||
33 | add_subdirectory(tests) | ||
34 | |||
35 | kpackage_install_package(package org.kube.accounts.maildir "genericqml") | 17 | kpackage_install_package(package org.kube.accounts.maildir "genericqml") |
36 | 18 | ||
37 | install(TARGETS maildiraccountplugin DESTINATION ${QML_INSTALL_DIR}/org/kube/accounts/maildir) | 19 | install(TARGETS maildiraccountplugin DESTINATION ${QML_INSTALL_DIR}/org/kube/accounts/maildir) |
diff --git a/accounts/maildir/tests/CMakeLists.txt b/accounts/maildir/tests/CMakeLists.txt deleted file mode 100644 index 13d706b2..00000000 --- a/accounts/maildir/tests/CMakeLists.txt +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | include_directories(../) | ||
2 | add_executable(maildirsettingstest settingstest.cpp) | ||
3 | add_test(maildirsettingstest maildirsettingstest) | ||
4 | target_link_libraries(maildirsettingstest | ||
5 | sink | ||
6 | maildiraccount_static | ||
7 | Qt5::Core | ||
8 | Qt5::Test | ||
9 | Qt5::Concurrent | ||
10 | ) | ||
diff --git a/accounts/maildir/tests/settingstest.cpp b/accounts/maildir/tests/settingstest.cpp deleted file mode 100644 index bf041e3c..00000000 --- a/accounts/maildir/tests/settingstest.cpp +++ /dev/null | |||
@@ -1,81 +0,0 @@ | |||
1 | #include <QTest> | ||
2 | #include <QDebug> | ||
3 | #include <QSignalSpy> | ||
4 | #include <functional> | ||
5 | #include <QStandardPaths> | ||
6 | #include <QDir> | ||
7 | #include <sink/test.h> | ||
8 | #include <sink/store.h> | ||
9 | |||
10 | #include "maildirsettings.h" | ||
11 | |||
12 | class SettingsTest : public QObject | ||
13 | { | ||
14 | Q_OBJECT | ||
15 | private slots: | ||
16 | |||
17 | void initTestCase() | ||
18 | { | ||
19 | Sink::Test::initTest(); | ||
20 | } | ||
21 | |||
22 | void testLoad() | ||
23 | { | ||
24 | auto accountId = "accountid"; | ||
25 | auto maildirPath = QDir::tempPath(); | ||
26 | auto smtpServer = QString("smtpserver"); | ||
27 | auto smtpUsername = QString("username"); | ||
28 | auto smtpPassword = QString("password"); | ||
29 | auto username = QString("username"); | ||
30 | auto emailAddress = QString("emailAddress"); | ||
31 | |||
32 | MaildirSettings settings; | ||
33 | settings.setAccountIdentifier(accountId); | ||
34 | settings.setPath(maildirPath); | ||
35 | settings.setProperty("smtpServer", smtpServer); | ||
36 | settings.setProperty("smtpUsername", smtpUsername); | ||
37 | settings.setProperty("smtpPassword", smtpPassword); | ||
38 | settings.setProperty("userName", username); | ||
39 | settings.setProperty("emailAddress", emailAddress); | ||
40 | settings.save(); | ||
41 | |||
42 | Sink::Store::fetchAll<Sink::ApplicationDomain::SinkResource>(Sink::Query()).then([](const QList<Sink::ApplicationDomain::SinkResource::Ptr> &resources) { | ||
43 | QCOMPARE(resources.size(), 2); | ||
44 | }) | ||
45 | .exec().waitForFinished(); | ||
46 | |||
47 | //Ensure we can read back all the information using the accountid | ||
48 | { | ||
49 | MaildirSettings readSettings; | ||
50 | QSignalSpy spy(&readSettings, &MaildirSettings::pathChanged); | ||
51 | QSignalSpy spy1(&readSettings, &MaildirSettings::smtpResourceChanged); | ||
52 | readSettings.setAccountIdentifier(accountId); | ||
53 | //Once for clear and once for once for the new setting | ||
54 | QTRY_COMPARE(spy.count(), 2); | ||
55 | QTRY_COMPARE(spy1.count(), 2); | ||
56 | QVERIFY(!readSettings.accountIdentifier().isEmpty()); | ||
57 | QCOMPARE(readSettings.path().toString(), maildirPath); | ||
58 | QCOMPARE(readSettings.property("smtpServer").toString(), smtpServer); | ||
59 | QCOMPARE(readSettings.property("smtpUsername").toString(), smtpUsername); | ||
60 | QCOMPARE(readSettings.property("smtpPassword").toString(), smtpPassword); | ||
61 | QCOMPARE(readSettings.property("userName").toString(), smtpUsername); | ||
62 | QCOMPARE(readSettings.property("emailAddress").toString(), emailAddress); | ||
63 | } | ||
64 | |||
65 | { | ||
66 | MaildirSettings settings; | ||
67 | QSignalSpy spy(&settings, &MaildirSettings::pathChanged); | ||
68 | settings.setAccountIdentifier(accountId); | ||
69 | QTRY_COMPARE(spy.count(), 2); | ||
70 | settings.remove(); | ||
71 | } | ||
72 | |||
73 | Sink::Store::fetchAll<Sink::ApplicationDomain::SinkResource>(Sink::Query()).then([](const QList<Sink::ApplicationDomain::SinkResource::Ptr> &resources) { | ||
74 | QCOMPARE(resources.size(), 0); | ||
75 | }) | ||
76 | .exec().waitForFinished(); | ||
77 | } | ||
78 | }; | ||
79 | |||
80 | QTEST_GUILESS_MAIN(SettingsTest) | ||
81 | #include "settingstest.moc" | ||