diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-11-29 11:27:04 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-11-29 11:27:04 +0100 |
commit | 6a072b2dcf23cbcdb210f2bd5c273ea0f425b188 (patch) | |
tree | cc2789c59e04018743aa0d575ee51a6f10869ffc /tests | |
parent | 81b459c0f013704e95fb5933525c82a6ca46f13f (diff) | |
download | sink-6a072b2dcf23cbcdb210f2bd5c273ea0f425b188.tar.gz sink-6a072b2dcf23cbcdb210f2bd5c273ea0f425b188.zip |
The synchronization call can be sync.
... because we really just enqueue the request and then wait for the
notification.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/mailsynctest.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/tests/mailsynctest.cpp b/tests/mailsynctest.cpp index 3927f14..72dbfd5 100644 --- a/tests/mailsynctest.cpp +++ b/tests/mailsynctest.cpp | |||
@@ -25,6 +25,8 @@ | |||
25 | 25 | ||
26 | #include "store.h" | 26 | #include "store.h" |
27 | #include "resourcecontrol.h" | 27 | #include "resourcecontrol.h" |
28 | #include "notifier.h" | ||
29 | #include "notification.h" | ||
28 | #include "log.h" | 30 | #include "log.h" |
29 | #include "test.h" | 31 | #include "test.h" |
30 | 32 | ||
@@ -411,10 +413,21 @@ void MailSyncTest::testFailingSync() | |||
411 | Sink::Query query; | 413 | Sink::Query query; |
412 | query.resourceFilter(resource.identifier()); | 414 | query.resourceFilter(resource.identifier()); |
413 | 415 | ||
416 | bool errorReceived = false; | ||
417 | |||
418 | //We currently don't get a proper error notification except for the status change | ||
419 | auto notifier = QSharedPointer<Sink::Notifier>::create(resource.identifier()); | ||
420 | notifier->registerHandler([&](const Notification ¬ification) { | ||
421 | SinkTrace() << "Received notification " << notification.type << notification.id; | ||
422 | if (notification.code == ApplicationDomain::ErrorStatus) { | ||
423 | errorReceived = true; | ||
424 | SinkWarning() << "Sync return an error"; | ||
425 | } | ||
426 | }); | ||
427 | |||
428 | VERIFYEXEC(Store::synchronize(query)); | ||
414 | // Ensure sync fails if resource is misconfigured | 429 | // Ensure sync fails if resource is misconfigured |
415 | auto future = Store::synchronize(query).exec(); | 430 | QTRY_VERIFY(errorReceived); |
416 | future.waitForFinished(); | ||
417 | QVERIFY(future.errorCode()); | ||
418 | } | 431 | } |
419 | 432 | ||
420 | #include "mailsynctest.moc" | 433 | #include "mailsynctest.moc" |