From 9efd56c64fe848b4557dccbdac244571d97bfc77 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 23 Aug 2017 20:49:37 -0600 Subject: A single test for all accountsettings. Only the imaptest was working anyways and all of them tested the same things. --- accounts/CMakeLists.txt | 8 +++ accounts/gmail/CMakeLists.txt | 8 --- accounts/imap/CMakeLists.txt | 12 +--- accounts/imap/tests/CMakeLists.txt | 10 --- accounts/imap/tests/settingstest.cpp | 120 -------------------------------- accounts/kolabnow/CMakeLists.txt | 18 ----- accounts/maildir/CMakeLists.txt | 18 ----- accounts/maildir/tests/CMakeLists.txt | 10 --- accounts/maildir/tests/settingstest.cpp | 81 --------------------- 9 files changed, 9 insertions(+), 276 deletions(-) delete mode 100644 accounts/imap/tests/CMakeLists.txt delete mode 100644 accounts/imap/tests/settingstest.cpp delete mode 100644 accounts/maildir/tests/CMakeLists.txt delete mode 100644 accounts/maildir/tests/settingstest.cpp (limited to 'accounts') 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 @@ include_directories(../framework/src/) +find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Core Quick Qml) + +find_package(Sink CONFIG REQUIRED) +find_package(KAsync CONFIG REQUIRED) +find_package(KF5 REQUIRED COMPONENTS Package Mime) + +include_directories(SYSTEM ${KDE_INSTALL_FULL_INCLUDEDIR}/KF5/) + add_subdirectory(maildir) add_subdirectory(imap) 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 @@ project(kube-accounts-gmail) -find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui) - -find_package(Sink CONFIG REQUIRED) -find_package(KAsync CONFIG REQUIRED) -find_package(KF5 REQUIRED COMPONENTS Package Mime) - -include_directories(SYSTEM ${KDE_INSTALL_FULL_INCLUDEDIR}/KF5/) - set(SRCS gmailsettings.cpp 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 @@ project(kube-accounts-imap) -find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Core Concurrent Quick Test Gui) +find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Core Quick Qml) find_package(Sink CONFIG REQUIRED) find_package(KAsync CONFIG REQUIRED) @@ -22,16 +22,6 @@ target_link_libraries(imapaccountplugin Qt5::Qml ) -add_library(imapaccount_static STATIC ${SRCS}) -target_link_libraries(imapaccount_static - sink - frameworkplugin - Qt5::Core - Qt5::Quick - Qt5::Qml -) -add_subdirectory(tests) - kpackage_install_package(package org.kube.accounts.imap "genericqml") 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 @@ -include_directories(../) -add_executable(imapsettingstest settingstest.cpp) -add_test(imapsettingstest imapsettingstest) -target_link_libraries(imapsettingstest - sink - imapaccount_static - Qt5::Core - Qt5::Concurrent - Qt5::Test -) 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 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -#include "imapsettings.h" - -class SettingsTest : public QObject -{ - Q_OBJECT -private slots: - - void initTestCase() - { - Sink::Test::initTest(); - } - - void testLoad() - { - auto accountId = "accountid"; - auto imapServer = QString("imapserver"); - auto imapUsername = QString("imapName"); - auto imapPassword = QString("imapPw"); - auto smtpServer = QString("smtpserver"); - auto smtpUsername = QString("smtpName"); - auto smtpPassword = QString("smtpPw"); - auto username = QString("username"); - auto emailAddress = QString("emailAddress"); - - ImapSettings settings; - settings.setAccountIdentifier(accountId); - settings.setProperty("imapServer", imapServer); - settings.setProperty("imapUsername", imapUsername); - settings.setProperty("imapPassword", imapPassword); - settings.setProperty("smtpServer", smtpServer); - settings.setProperty("smtpUsername", smtpUsername); - settings.setProperty("smtpPassword", smtpPassword); - settings.setProperty("userName", username); - settings.setProperty("emailAddress", emailAddress); - settings.save(); - - Sink::Store::fetchAll(Sink::Query()).then([](const QList &resources) { - QCOMPARE(resources.size(), 2); - }) - .exec().waitForFinished(); - - //Ensure we can read back all the information using the accountid - { - ImapSettings readSettings; - QSignalSpy spy(&readSettings, &ImapSettings::imapResourceChanged); - QSignalSpy spy1(&readSettings, &ImapSettings::smtpResourceChanged); - readSettings.setAccountIdentifier(accountId); - //Once for clear and once for the new setting - QTRY_COMPARE(spy.count(), 2); - QTRY_COMPARE(spy1.count(), 2); - QVERIFY(!readSettings.accountIdentifier().isEmpty()); - QCOMPARE(readSettings.property("imapServer").toString(), imapServer); - QCOMPARE(readSettings.property("imapUsername").toString(), imapUsername); - QCOMPARE(readSettings.property("imapPassword").toString(), imapPassword); - QCOMPARE(readSettings.property("smtpServer").toString(), smtpServer); - QCOMPARE(readSettings.property("smtpUsername").toString(), smtpUsername); - QCOMPARE(readSettings.property("smtpPassword").toString(), smtpPassword); - QCOMPARE(readSettings.property("userName").toString(), username); - QCOMPARE(readSettings.property("emailAddress").toString(), emailAddress); - } - - //Modify all settings - { - settings.setProperty("imapServer", imapServer + "mod"); - settings.setProperty("imapUsername", imapUsername + "mod"); - settings.setProperty("imapPassword", imapPassword + "mod"); - settings.setProperty("smtpServer", smtpServer + "mod"); - settings.setProperty("smtpUsername", smtpUsername + "mod"); - settings.setProperty("smtpPassword", smtpPassword + "mod"); - settings.setProperty("userName", username + "mod"); - settings.setProperty("emailAddress", emailAddress + "mod"); - settings.save(); - } - - //Read back settings again - { - ImapSettings readSettings; - QSignalSpy spy(&readSettings, &ImapSettings::imapResourceChanged); - QSignalSpy spy1(&readSettings, &ImapSettings::smtpResourceChanged); - readSettings.setAccountIdentifier(accountId); - //Once for clear and once for the new setting - QTRY_COMPARE(spy.count(), 2); - QTRY_COMPARE(spy1.count(), 2); - QVERIFY(!readSettings.accountIdentifier().isEmpty()); - QCOMPARE(readSettings.property("imapServer").toString(), imapServer + "mod"); - QCOMPARE(readSettings.property("imapUsername").toString(), imapUsername + "mod"); - QCOMPARE(readSettings.property("imapPassword").toString(), imapPassword + "mod"); - QCOMPARE(readSettings.property("smtpServer").toString(), smtpServer + "mod"); - QCOMPARE(readSettings.property("smtpUsername").toString(), smtpUsername + "mod"); - QCOMPARE(readSettings.property("smtpPassword").toString(), smtpPassword + "mod"); - QCOMPARE(readSettings.property("userName").toString(), username + "mod"); - QCOMPARE(readSettings.property("emailAddress").toString(), emailAddress + "mod"); - } - - { - ImapSettings settings; - QSignalSpy spy(&settings, &ImapSettings::imapResourceChanged); - settings.setAccountIdentifier(accountId); - QTRY_COMPARE(spy.count(), 2); - settings.remove(); - } - - Sink::Store::fetchAll(Sink::Query()).then([](const QList &resources) { - QCOMPARE(resources.size(), 0); - }) - .exec().waitForFinished(); - } -}; - -QTEST_GUILESS_MAIN(SettingsTest) -#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 @@ project(kube-accounts-kolabnow) -find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui) - -find_package(Sink CONFIG REQUIRED) -find_package(KAsync CONFIG REQUIRED) -find_package(KF5 REQUIRED COMPONENTS Package Mime) - -include_directories(SYSTEM ${KDE_INSTALL_FULL_INCLUDEDIR}/KF5/) - set(SRCS kolabnowsettings.cpp kolabnowaccountplugin.cpp @@ -22,16 +14,6 @@ target_link_libraries(kolabnowaccountplugin Qt5::Qml ) -add_library(kolabnowaccount_static STATIC ${SRCS}) -target_link_libraries(kolabnowaccount_static - sink - frameworkplugin - Qt5::Core - Qt5::Quick - Qt5::Qml -) -# add_subdirectory(tests) - kpackage_install_package(package org.kube.accounts.kolabnow "genericqml") 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 @@ project(kube-accounts-maildir) -find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Core Concurrent Quick Test Gui) - -find_package(Sink CONFIG REQUIRED) -find_package(KAsync CONFIG REQUIRED) -find_package(KF5 REQUIRED COMPONENTS Package Mime) - -include_directories(SYSTEM ${KDE_INSTALL_FULL_INCLUDEDIR}/KF5/) - set(SRCS maildirsettings.cpp maildiraccountplugin.cpp @@ -22,16 +14,6 @@ target_link_libraries(maildiraccountplugin Qt5::Qml ) -add_library(maildiraccount_static STATIC ${SRCS}) -target_link_libraries(maildiraccount_static - sink - frameworkplugin - Qt5::Core - Qt5::Quick - Qt5::Qml -) -add_subdirectory(tests) - kpackage_install_package(package org.kube.accounts.maildir "genericqml") 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 @@ -include_directories(../) -add_executable(maildirsettingstest settingstest.cpp) -add_test(maildirsettingstest maildirsettingstest) -target_link_libraries(maildirsettingstest - sink - maildiraccount_static - Qt5::Core - Qt5::Test - Qt5::Concurrent -) 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 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -#include "maildirsettings.h" - -class SettingsTest : public QObject -{ - Q_OBJECT -private slots: - - void initTestCase() - { - Sink::Test::initTest(); - } - - void testLoad() - { - auto accountId = "accountid"; - auto maildirPath = QDir::tempPath(); - auto smtpServer = QString("smtpserver"); - auto smtpUsername = QString("username"); - auto smtpPassword = QString("password"); - auto username = QString("username"); - auto emailAddress = QString("emailAddress"); - - MaildirSettings settings; - settings.setAccountIdentifier(accountId); - settings.setPath(maildirPath); - settings.setProperty("smtpServer", smtpServer); - settings.setProperty("smtpUsername", smtpUsername); - settings.setProperty("smtpPassword", smtpPassword); - settings.setProperty("userName", username); - settings.setProperty("emailAddress", emailAddress); - settings.save(); - - Sink::Store::fetchAll(Sink::Query()).then([](const QList &resources) { - QCOMPARE(resources.size(), 2); - }) - .exec().waitForFinished(); - - //Ensure we can read back all the information using the accountid - { - MaildirSettings readSettings; - QSignalSpy spy(&readSettings, &MaildirSettings::pathChanged); - QSignalSpy spy1(&readSettings, &MaildirSettings::smtpResourceChanged); - readSettings.setAccountIdentifier(accountId); - //Once for clear and once for once for the new setting - QTRY_COMPARE(spy.count(), 2); - QTRY_COMPARE(spy1.count(), 2); - QVERIFY(!readSettings.accountIdentifier().isEmpty()); - QCOMPARE(readSettings.path().toString(), maildirPath); - QCOMPARE(readSettings.property("smtpServer").toString(), smtpServer); - QCOMPARE(readSettings.property("smtpUsername").toString(), smtpUsername); - QCOMPARE(readSettings.property("smtpPassword").toString(), smtpPassword); - QCOMPARE(readSettings.property("userName").toString(), smtpUsername); - QCOMPARE(readSettings.property("emailAddress").toString(), emailAddress); - } - - { - MaildirSettings settings; - QSignalSpy spy(&settings, &MaildirSettings::pathChanged); - settings.setAccountIdentifier(accountId); - QTRY_COMPARE(spy.count(), 2); - settings.remove(); - } - - Sink::Store::fetchAll(Sink::Query()).then([](const QList &resources) { - QCOMPARE(resources.size(), 0); - }) - .exec().waitForFinished(); - } -}; - -QTEST_GUILESS_MAIN(SettingsTest) -#include "settingstest.moc" -- cgit v1.2.3