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/maildir/tests/settingstest.cpp | 81 --------------------------------- 1 file changed, 81 deletions(-) delete mode 100644 accounts/maildir/tests/settingstest.cpp (limited to 'accounts/maildir/tests/settingstest.cpp') 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