summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-11-14 10:01:20 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-11-14 10:01:20 +0100
commite3f5df951b4ed711224ac950f1669b91880273f8 (patch)
treebfddfada89b89cf9fb76f2e608146c006a7ab132 /tests
parenta1f275f87df6e9ea7f199e27ca7623aa99e333a3 (diff)
downloadsink-e3f5df951b4ed711224ac950f1669b91880273f8.tar.gz
sink-e3f5df951b4ed711224ac950f1669b91880273f8.zip
Sync single folder test
Diffstat (limited to 'tests')
-rw-r--r--tests/mailsynctest.cpp25
-rw-r--r--tests/mailsynctest.h2
2 files changed, 27 insertions, 0 deletions
diff --git a/tests/mailsynctest.cpp b/tests/mailsynctest.cpp
index 7edda32..3927f14 100644
--- a/tests/mailsynctest.cpp
+++ b/tests/mailsynctest.cpp
@@ -377,6 +377,31 @@ void MailSyncTest::testFlagChange()
377 377
378} 378}
379 379
380void MailSyncTest::testSyncSingleFolder()
381{
382 VERIFYEXEC(Store::synchronize(Sink::SyncScope{ApplicationDomain::getTypeName<Folder>()}.resourceFilter(mResourceInstanceIdentifier)));
383 VERIFYEXEC(ResourceControl::flushMessageQueue(mResourceInstanceIdentifier));
384
385 Folder::Ptr folder;
386 {
387 auto job = Store::fetchAll<Folder>(Sink::Query{}.resourceFilter(mResourceInstanceIdentifier).filter<Folder::Name>("test")).template syncThen<void, QList<Folder::Ptr>>([&](const QList<Folder::Ptr> &folders) {
388 QCOMPARE(folders.size(), 1);
389 folder = folders.first();
390 });
391 VERIFYEXEC(job);
392 }
393
394 auto syncScope = Sink::SyncScope{ApplicationDomain::getTypeName<Mail>()};
395 syncScope.resourceFilter(mResourceInstanceIdentifier);
396 syncScope.filter<Mail::Folder>(QVariant::fromValue(folder->identifier()));
397
398 // Ensure all local data is processed
399 VERIFYEXEC(Store::synchronize(syncScope));
400 VERIFYEXEC(ResourceControl::flushMessageQueue(mResourceInstanceIdentifier));
401
402
403}
404
380void MailSyncTest::testFailingSync() 405void MailSyncTest::testFailingSync()
381{ 406{
382 auto resource = createFaultyResource(); 407 auto resource = createFaultyResource();
diff --git a/tests/mailsynctest.h b/tests/mailsynctest.h
index 94643f6..8ad3bb3 100644
--- a/tests/mailsynctest.h
+++ b/tests/mailsynctest.h
@@ -69,6 +69,8 @@ private slots:
69 void testFetchNewRemovedMessages(); 69 void testFetchNewRemovedMessages();
70 void testFlagChange(); 70 void testFlagChange();
71 71
72 void testSyncSingleFolder();
73
72 void testFailingSync(); 74 void testFailingSync();
73}; 75};
74 76