diff options
Diffstat (limited to 'tests/maildirresourcetest.cpp')
-rw-r--r-- | tests/maildirresourcetest.cpp | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/tests/maildirresourcetest.cpp b/tests/maildirresourcetest.cpp index 46d2a28..0a32000 100644 --- a/tests/maildirresourcetest.cpp +++ b/tests/maildirresourcetest.cpp | |||
@@ -245,54 +245,6 @@ private slots: | |||
245 | QCOMPARE(mailModel->rowCount(QModelIndex()), 2); | 245 | QCOMPARE(mailModel->rowCount(QModelIndex()), 2); |
246 | } | 246 | } |
247 | 247 | ||
248 | void testCreateFolder() | ||
249 | { | ||
250 | Sink::Query query; | ||
251 | query.resources << "org.kde.maildir.instance1"; | ||
252 | |||
253 | // Ensure all local data is processed | ||
254 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); | ||
255 | |||
256 | Sink::ApplicationDomain::Folder folder("org.kde.maildir.instance1"); | ||
257 | folder.setProperty("name", "testCreateFolder"); | ||
258 | |||
259 | Sink::Store::create(folder).exec().waitForFinished(); | ||
260 | |||
261 | // Ensure all local data is processed | ||
262 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); | ||
263 | |||
264 | auto targetPath = tempDir.path() + "/maildir1/testCreateFolder"; | ||
265 | QFileInfo file(targetPath); | ||
266 | QTRY_VERIFY(file.exists()); | ||
267 | QVERIFY(file.isDir()); | ||
268 | } | ||
269 | |||
270 | void testRemoveFolder() | ||
271 | { | ||
272 | Sink::Query query; | ||
273 | query.resources << "org.kde.maildir.instance1"; | ||
274 | |||
275 | auto targetPath = tempDir.path() + "/maildir1/testCreateFolder"; | ||
276 | |||
277 | Sink::ApplicationDomain::Folder folder("org.kde.maildir.instance1"); | ||
278 | folder.setProperty("name", "testCreateFolder"); | ||
279 | Sink::Store::create(folder).exec().waitForFinished(); | ||
280 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); | ||
281 | QTRY_VERIFY(QFileInfo(targetPath).exists()); | ||
282 | |||
283 | Sink::Query folderQuery; | ||
284 | folderQuery.resources << "org.kde.maildir.instance1"; | ||
285 | folderQuery += Sink::Query::PropertyFilter("name", "testCreateFolder"); | ||
286 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(folderQuery); | ||
287 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); | ||
288 | QCOMPARE(model->rowCount(QModelIndex()), 1); | ||
289 | auto createdFolder = model->index(0, 0, QModelIndex()).data(Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::Folder::Ptr>(); | ||
290 | |||
291 | Sink::Store::remove(*createdFolder).exec().waitForFinished(); | ||
292 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); | ||
293 | QTRY_VERIFY(!QFileInfo(targetPath).exists()); | ||
294 | } | ||
295 | |||
296 | }; | 248 | }; |
297 | 249 | ||
298 | QTEST_MAIN(MaildirResourceTest) | 250 | QTEST_MAIN(MaildirResourceTest) |