Verified Commit e8990ce9 authored by Daniel Vrátil's avatar Daniel Vrátil 🤖
Browse files

Restore ENABLED/QRESYNC implementation (Revert the reverts)

This reverts commit 6e1b0314.
This reverts commit d532cfe1.
This reverts commit c7c41224.
This reverts commit 36f9f6b8.
This reverts commit c3715b5e.
This reverts commit 88e3ee34.
parent 6e1b0314
cmake_minimum_required(VERSION 3.5) cmake_minimum_required(VERSION 3.5)
set(PIM_VERSION "5.15.40") set(PIM_VERSION "5.15.41")
project(KIMAP VERSION ${PIM_VERSION}) project(KIMAP VERSION ${PIM_VERSION})
......
...@@ -26,9 +26,11 @@ KIMAP_UNIT_TESTS( ...@@ -26,9 +26,11 @@ KIMAP_UNIT_TESTS(
loginjobtest loginjobtest
logoutjobtest logoutjobtest
capabilitiesjobtest capabilitiesjobtest
closejobtest
selectjobtest selectjobtest
createjobtest createjobtest
deletejobtest deletejobtest
enablejobtest
expungejobtest expungejobtest
fetchjobtest fetchjobtest
renamejobtest renamejobtest
......
/*
SPDX-FileCopyrightText: 2020 Daniel Vrátil <dvratil@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <QTest>
#include "kimaptest/fakeserver.h"
#include "kimap/session.h"
#include "kimap/closejob.h"
#include <QTest>
class CloseJobTest: public QObject
{
Q_OBJECT
private Q_SLOTS:
void testClose_data()
{
QTest::addColumn<QList<QByteArray>>("scenario");
QTest::addColumn<quint64>("highestModSeq");
QList<QByteArray> scenario;
scenario << FakeServer::preauth()
<< "C: A000001 CLOSE"
<< "S: A000001 OK Closed";
QTest::newRow("good") << scenario << 0ULL;
scenario.clear();
scenario << FakeServer::preauth()
<< "C: A000001 CLOSE"
<< "S: A000001 BAD No mailbox selected";
QTest::newRow("bad") << scenario << 0ULL;
scenario.clear();
scenario << FakeServer::preauth()
<< "C: A000001 CLOSE"
<< "S: A000001 OK [HIGHESTMODSEQ 123456789] Closed.";
QTest::newRow("qresync") << scenario << 123456789ULL;
}
void testClose()
{
QFETCH(QList<QByteArray>, scenario);
QFETCH(quint64, highestModSeq);
FakeServer fakeServer;
fakeServer.setScenario(scenario);
fakeServer.startAndWait();
KIMAP::Session session(QStringLiteral("127.0.0.1"), 5989);
auto *job = new KIMAP::CloseJob(&session);
bool result = job->exec();
QEXPECT_FAIL("bad" , "Expected failure on BAD response", Continue);
QVERIFY(result);
if (result) {
QCOMPARE(job->newHighestModSeq(), highestModSeq);
}
fakeServer.quit();
}
};
QTEST_GUILESS_MAIN(CloseJobTest)
#include "closejobtest.moc"
/*
SPDX-FileCopyrightText: 2020 Daniel Vrátil <dvratil@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <QTest>
#include "kimaptest/fakeserver.h"
#include "kimap/session.h"
#include "kimap/enablejob.h"
#include <QTest>
#include <QSignalSpy>
#include <QDebug>
Q_DECLARE_METATYPE(QList<QList<QByteArray>>)
class EnableJobTest: public QObject
{
Q_OBJECT
private Q_SLOTS:
void testEnable_data()
{
QTest::addColumn<QList<QByteArray>>("scenario");
QTest::addColumn<QStringList>("reqCapabilities");
QTest::addColumn<QStringList>("supportedCaps");
QList<QByteArray> scenario;
scenario << FakeServer::preauth()
<< "C: A000001 ENABLE CONDSTORE X-GOOD-IDEA"
<< "S: * ENABLED X-GOOD-IDEA"
<< "S: A000001 OK Enabled";
QStringList reqCapabilities = {QStringLiteral("CONDSTORE"), QStringLiteral("X-GOOD-IDEA")};
QStringList supportedCaps = {QStringLiteral("X-GOOD-IDEA")};
QTest::newRow("one feature") << scenario << reqCapabilities << supportedCaps;
scenario.clear();
scenario << FakeServer::preauth()
<< "C: A000001 ENABLE FEATURE1 FEATURE2"
<< "S: * ENABLED FEATURE1 FEATURE2"
<< "S: A000001 OK Enabled";
reqCapabilities = QStringList{QStringLiteral("FEATURE1"), QStringLiteral("FEATURE2")};
supportedCaps = QStringList{QStringLiteral("FEATURE1"), QStringLiteral("FEATURE2")};
QTest::newRow("both features") << scenario << reqCapabilities << supportedCaps;
}
void testEnable()
{
QFETCH(QList<QByteArray>, scenario);
QFETCH(QStringList, reqCapabilities);
QFETCH(QStringList, supportedCaps);
FakeServer fakeServer;
fakeServer.setScenario(scenario);
fakeServer.startAndWait();
KIMAP::Session session(QStringLiteral("127.0.0.1"), 5989);
auto *job = new KIMAP::EnableJob(&session);
job->setCapabilities(reqCapabilities);
QVERIFY(job->exec());
QCOMPARE(job->enabledCapabilities(), supportedCaps);
fakeServer.quit();
}
};
QTEST_GUILESS_MAIN(EnableJobTest)
#include "enablejobtest.moc"
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "kimaptest/fakeserver.h" #include "kimaptest/fakeserver.h"
#include "kimap/session.h" #include "kimap/session.h"
#include "kimap/expungejob.h" #include "kimap/expungejob.h"
#include "imapset.h"
#include <QTest> #include <QTest>
...@@ -20,7 +21,9 @@ private Q_SLOTS: ...@@ -20,7 +21,9 @@ private Q_SLOTS:
void testDelete_data() void testDelete_data()
{ {
QTest::addColumn<QList<QByteArray> >("scenario"); QTest::addColumn<QList<QByteArray>>("scenario");
QTest::addColumn<KIMAP::ImapSet>("vanishedSet");
QTest::addColumn<quint64>("highestModSeq");
QList<QByteArray> scenario; QList<QByteArray> scenario;
scenario << FakeServer::preauth() scenario << FakeServer::preauth()
...@@ -29,31 +32,43 @@ private Q_SLOTS: ...@@ -29,31 +32,43 @@ private Q_SLOTS:
<< "S: * 2 EXPUNGE" << "S: * 2 EXPUNGE"
<< "S: * 3 EXPUNGE" << "S: * 3 EXPUNGE"
<< "S: A000001 OK EXPUNGE completed"; << "S: A000001 OK EXPUNGE completed";
QTest::newRow("good") << scenario; QTest::newRow("good") << scenario << KIMAP::ImapSet{} << 0ULL;
scenario.clear(); scenario.clear();
scenario << FakeServer::preauth() scenario << FakeServer::preauth()
<< "C: A000001 EXPUNGE" << "C: A000001 EXPUNGE"
<< "S: * 1" // missing EXPUNGE word << "S: * 1" // missing EXPUNGE word
<< "S: A000001 OK EXPUNGE completed"; << "S: A000001 OK EXPUNGE completed";
QTest::newRow("non-standard response") << scenario; QTest::newRow("non-standard response") << scenario << KIMAP::ImapSet{} << 0ULL;
scenario.clear(); scenario.clear();
scenario << FakeServer::preauth() scenario << FakeServer::preauth()
<< "C: A000001 EXPUNGE" << "C: A000001 EXPUNGE"
<< "S: A000001 BAD command unknown or arguments invalid"; << "S: A000001 BAD command unknown or arguments invalid";
QTest::newRow("bad") << scenario; QTest::newRow("bad") << scenario << KIMAP::ImapSet{} << 0ULL;
scenario.clear(); scenario.clear();
scenario << FakeServer::preauth() scenario << FakeServer::preauth()
<< "C: A000001 EXPUNGE" << "C: A000001 EXPUNGE"
<< "S: A000001 NO access denied"; << "S: A000001 NO access denied";
QTest::newRow("no") << scenario; QTest::newRow("no") << scenario << KIMAP::ImapSet{} << 0ULL;
scenario.clear();
scenario << FakeServer::preauth()
<< "C: A000001 EXPUNGE"
<< "S: * VANISHED 405,407,410:420"
<< "S: A000001 OK [HIGHESTMODSEQ 123456789] Expunged.";
KIMAP::ImapSet vanishedSet;
vanishedSet.add(KIMAP::ImapInterval{405, 407});
vanishedSet.add(KIMAP::ImapInterval{410, 420});
QTest::newRow("qresync") << scenario << vanishedSet << 123456789ULL;
} }
void testDelete() void testDelete()
{ {
QFETCH(QList<QByteArray>, scenario); QFETCH(QList<QByteArray>, scenario);
QFETCH(KIMAP::ImapSet, vanishedSet);
QFETCH(quint64, highestModSeq);
FakeServer fakeServer; FakeServer fakeServer;
fakeServer.setScenario(scenario); fakeServer.setScenario(scenario);
...@@ -66,6 +81,10 @@ private Q_SLOTS: ...@@ -66,6 +81,10 @@ private Q_SLOTS:
QEXPECT_FAIL("bad" , "Expected failure on BAD response", Continue); QEXPECT_FAIL("bad" , "Expected failure on BAD response", Continue);
QEXPECT_FAIL("no" , "Expected failure on NO response", Continue); QEXPECT_FAIL("no" , "Expected failure on NO response", Continue);
QVERIFY(result); QVERIFY(result);
if (result) {
QCOMPARE(job->vanishedMessages(), vanishedSet);
QCOMPARE(job->newHighestModSeq(), highestModSeq);
}
fakeServer.quit(); fakeServer.quit();
} }
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "kimap/fetchjob.h" #include "kimap/fetchjob.h"
#include <QTest> #include <QTest>
#include <QSignalSpy>
Q_DECLARE_METATYPE(KIMAP::FetchJob::FetchScope) Q_DECLARE_METATYPE(KIMAP::FetchJob::FetchScope)
...@@ -19,6 +20,12 @@ class FetchJobTest: public QObject ...@@ -19,6 +20,12 @@ class FetchJobTest: public QObject
{ {
Q_OBJECT Q_OBJECT
public:
FetchJobTest()
{
qRegisterMetaType<KIMAP::ImapSet>();
}
private: private:
QStringList m_signals; QStringList m_signals;
...@@ -80,10 +87,11 @@ private Q_SLOTS: ...@@ -80,10 +87,11 @@ private Q_SLOTS:
qRegisterMetaType<KIMAP::FetchJob::FetchScope>(); qRegisterMetaType<KIMAP::FetchJob::FetchScope>();
QTest::addColumn<bool>("uidBased"); QTest::addColumn<bool>("uidBased");
QTest::addColumn< KIMAP::ImapSet >("set"); QTest::addColumn<KIMAP::ImapSet>("set");
QTest::addColumn<int>("expectedMessageCount"); QTest::addColumn<int>("expectedMessageCount");
QTest::addColumn< QList<QByteArray> >("scenario"); QTest::addColumn<QList<QByteArray>>("scenario");
QTest::addColumn<KIMAP::FetchJob::FetchScope>("scope"); QTest::addColumn<KIMAP::FetchJob::FetchScope>("scope");
QTest::addColumn<KIMAP::ImapSet>("expectedVanished");
KIMAP::FetchJob::FetchScope scope; KIMAP::FetchJob::FetchScope scope;
scope.mode = KIMAP::FetchJob::FetchScope::Flags; scope.mode = KIMAP::FetchJob::FetchScope::Flags;
...@@ -99,7 +107,7 @@ private Q_SLOTS: ...@@ -99,7 +107,7 @@ private Q_SLOTS:
<< "S: A000001 OK fetch done"; << "S: A000001 OK fetch done";
QTest::newRow("messages have empty flags (with changedsince)") << false << KIMAP::ImapSet(1, 4) << 4 QTest::newRow("messages have empty flags (with changedsince)") << false << KIMAP::ImapSet(1, 4) << 4
<< scenario << scope; << scenario << scope << KIMAP::ImapSet{};
scenario.clear(); scenario.clear();
scope.changedSince = 0; scope.changedSince = 0;
...@@ -112,7 +120,7 @@ private Q_SLOTS: ...@@ -112,7 +120,7 @@ private Q_SLOTS:
<< "S: A000001 OK fetch done"; << "S: A000001 OK fetch done";
QTest::newRow("messages have empty flags") << false << KIMAP::ImapSet(1, 4) << 4 QTest::newRow("messages have empty flags") << false << KIMAP::ImapSet(1, 4) << 4
<< scenario << scope; << scenario << scope << KIMAP::ImapSet{};
scenario.clear(); scenario.clear();
// kill the connection part-way through a list, with carriage returns at end // kill the connection part-way through a list, with carriage returns at end
...@@ -124,7 +132,7 @@ private Q_SLOTS: ...@@ -124,7 +132,7 @@ private Q_SLOTS:
<< "S: From: John Smith <jonathanr.smith@foobarbaz.com>\r\nTo: \"amagicemailaddress@foobarbazbarfoo.com\"\r\n\t<amagicemailaddress@foobarbazbarfoo.com>\r\nDate: Mon, 11 Oct 2010 03:34:48 +0100\r\nSubject: unsubscribe\r\nMessage-ID: <ASDFFDSASDFFDS@foobarbaz.com>\r\n\r\n" << "S: From: John Smith <jonathanr.smith@foobarbaz.com>\r\nTo: \"amagicemailaddress@foobarbazbarfoo.com\"\r\n\t<amagicemailaddress@foobarbazbarfoo.com>\r\nDate: Mon, 11 Oct 2010 03:34:48 +0100\r\nSubject: unsubscribe\r\nMessage-ID: <ASDFFDSASDFFDS@foobarbaz.com>\r\n\r\n"
<< "X"; << "X";
scope.mode = KIMAP::FetchJob::FetchScope::Headers; scope.mode = KIMAP::FetchJob::FetchScope::Headers;
QTest::newRow("connection drop") << false << KIMAP::ImapSet(11, 11) << 1 << scenario << scope; QTest::newRow("connection drop") << false << KIMAP::ImapSet(11, 11) << 1 << scenario << scope << KIMAP::ImapSet{};
scenario.clear(); scenario.clear();
// Important bit here if "([127.0.0.1])" which used to crash the stream parser // Important bit here if "([127.0.0.1])" which used to crash the stream parser
...@@ -134,7 +142,7 @@ private Q_SLOTS: ...@@ -134,7 +142,7 @@ private Q_SLOTS:
<< "S: ([127.0.0.1])\r\nDate: Mon, 11 Oct 2010 03:34:48 +0100\r\nSubject: unsubscribe\r\nMessage-ID: <ASDFFDSASDFFDS@foobarbaz.com>\r\n\r\n" << "S: ([127.0.0.1])\r\nDate: Mon, 11 Oct 2010 03:34:48 +0100\r\nSubject: unsubscribe\r\nMessage-ID: <ASDFFDSASDFFDS@foobarbaz.com>\r\n\r\n"
<< "X"; << "X";
scope.mode = KIMAP::FetchJob::FetchScope::Headers; scope.mode = KIMAP::FetchJob::FetchScope::Headers;
QTest::newRow("buffer overwrite") << false << KIMAP::ImapSet(11, 11) << 1 << scenario << scope; QTest::newRow("buffer overwrite") << false << KIMAP::ImapSet(11, 11) << 1 << scenario << scope << KIMAP::ImapSet{};
scenario.clear(); scenario.clear();
// We're assuming a buffer overwrite here which made us miss the opening parenthesis // We're assuming a buffer overwrite here which made us miss the opening parenthesis
...@@ -144,7 +152,7 @@ private Q_SLOTS: ...@@ -144,7 +152,7 @@ private Q_SLOTS:
<< "S: * 11 FETCH {10}doh!\r\n\r\n\r\n)\r\n" << "S: * 11 FETCH {10}doh!\r\n\r\n\r\n)\r\n"
<< "X"; << "X";
scope.mode = KIMAP::FetchJob::FetchScope::Headers; scope.mode = KIMAP::FetchJob::FetchScope::Headers;
QTest::newRow("buffer overwrite 2") << false << KIMAP::ImapSet(11, 11) << 1 << scenario << scope; QTest::newRow("buffer overwrite 2") << false << KIMAP::ImapSet(11, 11) << 1 << scenario << scope << KIMAP::ImapSet{};
scenario.clear(); scenario.clear();
scenario << FakeServer::preauth() scenario << FakeServer::preauth()
...@@ -155,7 +163,24 @@ private Q_SLOTS: ...@@ -155,7 +163,24 @@ private Q_SLOTS:
scope.mode = KIMAP::FetchJob::FetchScope::FullHeaders; scope.mode = KIMAP::FetchJob::FetchScope::FullHeaders;
scope.changedSince = 123456789; scope.changedSince = 123456789;
QTest::newRow("fetch full headers") << false << KIMAP::ImapSet(11, 11) << 1 QTest::newRow("fetch full headers") << false << KIMAP::ImapSet(11, 11) << 1
<< scenario << scope; << scenario << scope << KIMAP::ImapSet{};
scenario.clear();
scenario << FakeServer::preauth()
<< "C: A000001 UID FETCH 300:500 (FLAGS UID) (CHANGEDSINCE 12345 VANISHED)"
<< "S: * VANISHED (EARLIER) 300:310,405,411"
<< "S: * 1 FETCH (UID 404 MODSEQ (65402) FLAGS (\\Seen))"
<< "S: * 2 FETCH (UID 406 MODSEQ (75403) FLAGS (\\Deleted))"
<< "S: * 4 FETCH (UID 408 MODSEQ (29738) FLAGS ($Nojunk $AutoJunk $MDNSent))"
<< "S: A000001 OK Fetch completed";
scope.mode = KIMAP::FetchJob::FetchScope::Flags;
scope.changedSince = 12345;
scope.qresync = true;
KIMAP::ImapSet vanished;
vanished.add(KIMAP::ImapInterval{300, 310});
vanished.add(KIMAP::ImapInterval{405, 411});
QTest::newRow("qresync") << true << KIMAP::ImapSet(300, 500) << 3 << scenario << scope << vanished;
} }
void testFetch() void testFetch()
...@@ -165,6 +190,7 @@ private Q_SLOTS: ...@@ -165,6 +190,7 @@ private Q_SLOTS:
QFETCH(int, expectedMessageCount); QFETCH(int, expectedMessageCount);
QFETCH(QList<QByteArray>, scenario); QFETCH(QList<QByteArray>, scenario);
QFETCH(KIMAP::FetchJob::FetchScope, scope); QFETCH(KIMAP::FetchJob::FetchScope, scope);
QFETCH(KIMAP::ImapSet, expectedVanished);
FakeServer fakeServer; FakeServer fakeServer;
fakeServer.setScenario(scenario); fakeServer.setScenario(scenario);
...@@ -192,6 +218,9 @@ private Q_SLOTS: ...@@ -192,6 +218,9 @@ private Q_SLOTS:
connect(job, &KIMAP::FetchJob::messagesAvailable, connect(job, &KIMAP::FetchJob::messagesAvailable,
this, &FetchJobTest::onMessagesAvailable); this, &FetchJobTest::onMessagesAvailable);
QSignalSpy vanishedSpy(job, &KIMAP::FetchJob::messagesVanished);
QVERIFY(vanishedSpy.isValid());
bool result = job->exec(); bool result = job->exec();
QEXPECT_FAIL("connection drop", "Expected failure on connection drop", Continue); QEXPECT_FAIL("connection drop", "Expected failure on connection drop", Continue);
QEXPECT_FAIL("buffer overwrite", "Expected failure on confused list", Continue); QEXPECT_FAIL("buffer overwrite", "Expected failure on confused list", Continue);
...@@ -201,6 +230,10 @@ private Q_SLOTS: ...@@ -201,6 +230,10 @@ private Q_SLOTS:
QVERIFY(m_signals.count() > 0); QVERIFY(m_signals.count() > 0);
QCOMPARE(m_uids.count(), expectedMessageCount); QCOMPARE(m_uids.count(), expectedMessageCount);
QCOMPARE(m_msgs.count(), expectedMessageCount); QCOMPARE(m_msgs.count(), expectedMessageCount);
if (scope.qresync) {
QCOMPARE(vanishedSpy.size(), 1);
QCOMPARE(vanishedSpy.at(0).at(0).value<KIMAP::ImapSet>(), expectedVanished);
}
} }
QVERIFY(fakeServer.isAllScenarioDone()); QVERIFY(fakeServer.isAllScenarioDone());
......
...@@ -9,22 +9,36 @@ ...@@ -9,22 +9,36 @@
#include <QSslConfiguration> #include <QSslConfiguration>
#include <QDebug> #include <QDebug>
// Generated on 2020-10-07 using command:
// openssl req -nodes -new -x509 -keyout key.pem -out cert.pem -days 36500
//
// The cert should be valid until 2120.
static QByteArray staticCert() static QByteArray staticCert()
{ {
//a dummy certificate //a dummy certificate
return QByteArray( return QByteArray(
"-----BEGIN CERTIFICATE-----\n\ "-----BEGIN CERTIFICATE-----\n\
MIIB+zCCAWQCCQDBBi7xZ2944DANBgkqhkiG9w0BAQUFADBCMQswCQYDVQQGEwJY\n\ MIIDZzCCAk+gAwIBAgIUQoBjjbd//7DD9zWfru/epnVT2vAwDQYJKoZIhvcNAQEL\n\
WDEVMBMGA1UEBwwMRGVmYXVsdCBDaXR5MRwwGgYDVQQKDBNEZWZhdWx0IENvbXBh\n\ BQAwQjELMAkGA1UEBhMCWFgxFTATBgNVBAcMDERlZmF1bHQgQ2l0eTEcMBoGA1UE\n\
bnkgTHRkMB4XDTEzMTIwNTA5MDcxNVoXDTQxMDQyMjA5MDcxNVowQjELMAkGA1UE\n\ CgwTRGVmYXVsdC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NB8sCAwEAAaNTMFEwHQYDVR0OBBYE\n\
FLi6xsBAkbc06veA7t+8slAUCVebMB8GA1UdIwQYMBaAFLi6xsBAkbc06veA7t+8\n\
slAUCVebMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAFpcIzOl\n\
iqMK/kre/xJyE+S1UoS85rmegZDkNdEXUS6zCozL+eO2NxHxumxfD3qrdwLvXfn0\n\
y30xUlNecB30/egXrel9z7Xop70sVCfgfb/vfMmQ5KSUZC8968rgHPl5qPmjZk6X\n\
z0M9hktTRpIk43DPuz5k1qD+LsmrKzI7twGu00EenwVZa4eLN36Ju4ZRg3I0h2zH\n\
vAnuAku0F0JU9GXdbjOW/248k+jhMP1noDaLqwVkkjgzaJwHxFNiKxnG3f7anneK\n\
HxybczmNl3a6IsZN0CSUSwLfvr1Wezk2Mb7dwzhPbycP5icB/KXWgApkRZ3MKfLN\n\
aBvBMCfr7GXmLQk=\n\
-----END CERTIFICATE-----"); -----END CERTIFICATE-----");
} }
...@@ -32,21 +46,34 @@ static QByteArray staticKey() ...@@ -32,21 +46,34 @@ static QByteArray staticKey()
{ {
//a dummy key without password //a dummy key without password
return QByteArray( return QByteArray(
"-----BEGIN RSA PRIVATE KEY-----\n\ "-----BEGIN PRIVATE KEY-----\n\
MIICXgIBAAKBgQDK5l16pODNfYRD606Pz9DNPyMc5S/CV6q/nqEA4RtnmkuFg96x\n\ MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDCLtDrIo2tmyCD\n\
pKpXSUAOJgcqMJFUiuElBd49/vIysnfMTqFscQygiP6S7q201CR8mJ/fTCZtfEtc\n\ XQo7j9E/rXZUDiPJedifs/3SOOTMXnBJ+SwLGFoamp6YGUjObRX+Malml/9f01Qw\n\
75GqtpiAlbvfSRxuLYnKrtyIQLVJV6IhpqJXbJQUFz8BEMUFzvvfdjTndQIDAQAB\n\ eSYi8d76Fjjg07TSsxVRQs3yh7h+nAW6BBOE2f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Tw\n\
2k6FDQ7S1lEt6jbVBtS189LtaZBnEWZQfyjKl8h6lJyVU2kBfaYoEOO31T8n20sG\n\
NdkmACeCyNMs5V3yq1vAeN4=\n\
-----END PRIVATE KEY-----");
} }
SslServer::SslServer(QSsl::SslProtocol protocol, bool waitForStartTls) SslServer::SslServer(QSsl::SslProtocol protocol, bool waitForStartTls)
......
...@@ -15,11 +15,26 @@ ...@@ -15,11 +15,26 @@
#include "kimap/selectjob.h" #include "kimap/selectjob.h"
#include <QTest> #include <QTest>
#include <QSignalSpy>
using Messages = QMap<qint64, KIMAP::Message>;
Q_DECLARE_METATYPE(KIMAP::Message)
Q_DECLARE_METATYPE(Messages)
class SelectJobTest: public QObject class SelectJobTest: public QObject
{ {
Q_OBJECT Q_OBJECT
public: