diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-05-23 13:55:36 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-05-23 13:55:36 +0200 |
commit | a853cb1a32ae9207501fc4378357107013ebce21 (patch) | |
tree | 982b30db053dc03921a5c7e55ee3f097e2d8c439 /examples/imapresource/tests/imapresourcetest.cpp | |
parent | f38554ad4c7ff918bf7792413e6599e69d30cf3a (diff) | |
download | sink-a853cb1a32ae9207501fc4378357107013ebce21.tar.gz sink-a853cb1a32ae9207501fc4378357107013ebce21.zip |
Message removals
Diffstat (limited to 'examples/imapresource/tests/imapresourcetest.cpp')
-rw-r--r-- | examples/imapresource/tests/imapresourcetest.cpp | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/examples/imapresource/tests/imapresourcetest.cpp b/examples/imapresource/tests/imapresourcetest.cpp index 8ce32c2..30bb953 100644 --- a/examples/imapresource/tests/imapresourcetest.cpp +++ b/examples/imapresource/tests/imapresourcetest.cpp | |||
@@ -65,6 +65,8 @@ private slots: | |||
65 | resource.setProperty("identifier", "org.kde.imap.instance1"); | 65 | resource.setProperty("identifier", "org.kde.imap.instance1"); |
66 | resource.setProperty("type", "org.kde.imap"); | 66 | resource.setProperty("type", "org.kde.imap"); |
67 | resource.setProperty("server", "localhost"); | 67 | resource.setProperty("server", "localhost"); |
68 | resource.setProperty("user", "doe"); | ||
69 | resource.setProperty("password", "doe"); | ||
68 | resource.setProperty("port", 993); | 70 | resource.setProperty("port", 993); |
69 | Sink::Store::create(resource).exec().waitForFinished(); | 71 | Sink::Store::create(resource).exec().waitForFinished(); |
70 | } | 72 | } |
@@ -164,8 +166,8 @@ private slots: | |||
164 | VERIFYEXEC(Store::synchronize(query)); | 166 | VERIFYEXEC(Store::synchronize(query)); |
165 | ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); | 167 | ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
166 | 168 | ||
167 | ImapServerProxy imap("localhost", 993); | 169 | Imap::ImapServerProxy imap("localhost", 993); |
168 | imap.login("doe", "doe").exec().waitForFinished(); | 170 | VERIFYEXEC(imap.login("doe", "doe")); |
169 | 171 | ||
170 | auto msg = KMime::Message::Ptr::create(); | 172 | auto msg = KMime::Message::Ptr::create(); |
171 | msg->subject(true)->fromUnicodeString("Foobar", "utf8"); | 173 | msg->subject(true)->fromUnicodeString("Foobar", "utf8"); |
@@ -182,6 +184,30 @@ private slots: | |||
182 | VERIFYEXEC(job); | 184 | VERIFYEXEC(job); |
183 | } | 185 | } |
184 | 186 | ||
187 | void testFetchRemovedMessages() | ||
188 | { | ||
189 | Sink::Query query; | ||
190 | query.resources << "org.kde.imap.instance1"; | ||
191 | query.request<Mail::Subject>().request<Mail::MimeMessage>(); | ||
192 | |||
193 | // Ensure all local data is processed | ||
194 | VERIFYEXEC(Store::synchronize(query)); | ||
195 | ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); | ||
196 | |||
197 | Imap::ImapServerProxy imap("localhost", 993); | ||
198 | VERIFYEXEC(imap.login("doe", "doe")); | ||
199 | |||
200 | VERIFYEXEC(imap.remove("INBOX.test", "2:*")); | ||
201 | |||
202 | Store::synchronize(query).exec().waitForFinished(); | ||
203 | ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); | ||
204 | |||
205 | auto job = Store::fetchAll<Mail>(query).then<void, QList<Mail::Ptr>>([](const QList<Mail::Ptr> &mails) { | ||
206 | QCOMPARE(mails.size(), 1); | ||
207 | }); | ||
208 | VERIFYEXEC(job); | ||
209 | } | ||
210 | |||
185 | void testFailingSync() | 211 | void testFailingSync() |
186 | { | 212 | { |
187 | auto resource = ApplicationDomain::ImapResource::create("account1"); | 213 | auto resource = ApplicationDomain::ImapResource::create("account1"); |