diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-05-23 14:09:20 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-05-23 14:09:20 +0200 |
commit | 422950c63f830e4d01315afc37d0144f79bf10db (patch) | |
tree | 11673ef4de636100e19a3a97680c7c6c96462ee3 /examples/imapresource/tests | |
parent | a853cb1a32ae9207501fc4378357107013ebce21 (diff) | |
download | sink-422950c63f830e4d01315afc37d0144f79bf10db.tar.gz sink-422950c63f830e4d01315afc37d0144f79bf10db.zip |
Test adding and removing of folders
Diffstat (limited to 'examples/imapresource/tests')
-rw-r--r-- | examples/imapresource/tests/imapresourcetest.cpp | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/examples/imapresource/tests/imapresourcetest.cpp b/examples/imapresource/tests/imapresourcetest.cpp index 30bb953..7d4453b 100644 --- a/examples/imapresource/tests/imapresourcetest.cpp +++ b/examples/imapresource/tests/imapresourcetest.cpp | |||
@@ -132,6 +132,57 @@ private slots: | |||
132 | VERIFYEXEC(job); | 132 | VERIFYEXEC(job); |
133 | } | 133 | } |
134 | 134 | ||
135 | void testListNewFolders() | ||
136 | { | ||
137 | Sink::Query query; | ||
138 | query.resources << "org.kde.imap.instance1"; | ||
139 | query.request<Folder::Name>(); | ||
140 | |||
141 | Imap::ImapServerProxy imap("localhost", 993); | ||
142 | VERIFYEXEC(imap.login("doe", "doe")); | ||
143 | VERIFYEXEC(imap.create("INBOX.test.sub1")); | ||
144 | |||
145 | // Ensure all local data is processed | ||
146 | VERIFYEXEC(Store::synchronize(query)); | ||
147 | ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); | ||
148 | |||
149 | auto job = Store::fetchAll<Folder>(query).then<void, QList<Folder::Ptr>>([](const QList<Folder::Ptr> &folders) { | ||
150 | QStringList names; | ||
151 | for (const auto &folder : folders) { | ||
152 | names << folder->getName(); | ||
153 | } | ||
154 | QVERIFY(names.contains("sub1")); | ||
155 | }); | ||
156 | VERIFYEXEC(job); | ||
157 | } | ||
158 | |||
159 | void testListRemovedFolders() | ||
160 | { | ||
161 | Sink::Query query; | ||
162 | query.resources << "org.kde.imap.instance1"; | ||
163 | query.request<Folder::Name>(); | ||
164 | |||
165 | VERIFYEXEC(Store::synchronize(query)); | ||
166 | ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); | ||
167 | |||
168 | Imap::ImapServerProxy imap("localhost", 993); | ||
169 | VERIFYEXEC(imap.login("doe", "doe")); | ||
170 | VERIFYEXEC(imap.remove("INBOX.test.sub1")); | ||
171 | |||
172 | // Ensure all local data is processed | ||
173 | VERIFYEXEC(Store::synchronize(query)); | ||
174 | ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); | ||
175 | |||
176 | auto job = Store::fetchAll<Folder>(query).then<void, QList<Folder::Ptr>>([](const QList<Folder::Ptr> &folders) { | ||
177 | QStringList names; | ||
178 | for (const auto &folder : folders) { | ||
179 | names << folder->getName(); | ||
180 | } | ||
181 | QVERIFY(!names.contains("sub1")); | ||
182 | }); | ||
183 | VERIFYEXEC(job); | ||
184 | } | ||
185 | |||
135 | void testListMails() | 186 | void testListMails() |
136 | { | 187 | { |
137 | Sink::Query query; | 188 | Sink::Query query; |