diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-04-07 16:20:00 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-04-07 16:20:00 +0200 |
commit | c210d8c434d5fa8f6c56bbbdb0cb993ddd697213 (patch) | |
tree | f3f62d8b6ff8665605d3c22997c0e58f233f20c9 /tests/mailsynctest.cpp | |
parent | 41c69690d866414cf90d603629fd488ba9a981b5 (diff) | |
download | sink-c210d8c434d5fa8f6c56bbbdb0cb993ddd697213.tar.gz sink-c210d8c434d5fa8f6c56bbbdb0cb993ddd697213.zip |
Avoid crashing if we fail to resolve the local id.
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(); |