diff options
Diffstat (limited to 'tests/mailsynctest.cpp')
-rw-r--r-- | tests/mailsynctest.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/mailsynctest.cpp b/tests/mailsynctest.cpp index 3e5a928..c8ba9f1 100644 --- a/tests/mailsynctest.cpp +++ b/tests/mailsynctest.cpp | |||
@@ -411,6 +411,43 @@ void MailSyncTest::testSyncSingleFolder() | |||
411 | 411 | ||
412 | } | 412 | } |
413 | 413 | ||
414 | void MailSyncTest::testSyncSingleMail() | ||
415 | { | ||
416 | VERIFYEXEC(Store::synchronize(Sink::SyncScope{}.resourceFilter(mResourceInstanceIdentifier))); | ||
417 | VERIFYEXEC(ResourceControl::flushMessageQueue(mResourceInstanceIdentifier)); | ||
418 | |||
419 | Mail::Ptr mail; | ||
420 | { | ||
421 | auto job = Store::fetchAll<Mail>(Sink::Query{}.resourceFilter(mResourceInstanceIdentifier)).template then([&](const QList<Mail::Ptr> &mails) { | ||
422 | QVERIFY(mails.size() >= 1); | ||
423 | mail = mails.first(); | ||
424 | }); | ||
425 | VERIFYEXEC(job); | ||
426 | } | ||
427 | |||
428 | auto syncScope = Sink::SyncScope{ApplicationDomain::getTypeName<Mail>()}; | ||
429 | syncScope.resourceFilter(mResourceInstanceIdentifier); | ||
430 | syncScope.filter(mail->identifier()); | ||
431 | |||
432 | // Ensure all local data is processed | ||
433 | VERIFYEXEC(Store::synchronize(syncScope)); | ||
434 | VERIFYEXEC(ResourceControl::flushMessageQueue(mResourceInstanceIdentifier)); | ||
435 | } | ||
436 | |||
437 | void MailSyncTest::testSyncSingleMailWithBogusId() | ||
438 | { | ||
439 | VERIFYEXEC(Store::synchronize(Sink::SyncScope{}.resourceFilter(mResourceInstanceIdentifier))); | ||
440 | VERIFYEXEC(ResourceControl::flushMessageQueue(mResourceInstanceIdentifier)); | ||
441 | |||
442 | auto syncScope = Sink::SyncScope{ApplicationDomain::getTypeName<Mail>()}; | ||
443 | syncScope.resourceFilter(mResourceInstanceIdentifier); | ||
444 | syncScope.filter("WTFisThisEven?"); | ||
445 | |||
446 | // Ensure all local data is processed | ||
447 | VERIFYEXEC(Store::synchronize(syncScope)); | ||
448 | VERIFYEXEC(ResourceControl::flushMessageQueue(mResourceInstanceIdentifier)); | ||
449 | } | ||
450 | |||
414 | void MailSyncTest::testFailingSync() | 451 | void MailSyncTest::testFailingSync() |
415 | { | 452 | { |
416 | auto resource = createFaultyResource(); | 453 | auto resource = createFaultyResource(); |