From 6a072b2dcf23cbcdb210f2bd5c273ea0f425b188 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 29 Nov 2016 11:27:04 +0100 Subject: The synchronization call can be sync. ... because we really just enqueue the request and then wait for the notification. --- tests/mailsynctest.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'tests') 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 @@ #include "store.h" #include "resourcecontrol.h" +#include "notifier.h" +#include "notification.h" #include "log.h" #include "test.h" @@ -411,10 +413,21 @@ void MailSyncTest::testFailingSync() Sink::Query query; query.resourceFilter(resource.identifier()); + bool errorReceived = false; + + //We currently don't get a proper error notification except for the status change + auto notifier = QSharedPointer::create(resource.identifier()); + notifier->registerHandler([&](const Notification ¬ification) { + SinkTrace() << "Received notification " << notification.type << notification.id; + if (notification.code == ApplicationDomain::ErrorStatus) { + errorReceived = true; + SinkWarning() << "Sync return an error"; + } + }); + + VERIFYEXEC(Store::synchronize(query)); // Ensure sync fails if resource is misconfigured - auto future = Store::synchronize(query).exec(); - future.waitForFinished(); - QVERIFY(future.errorCode()); + QTRY_VERIFY(errorReceived); } #include "mailsynctest.moc" -- cgit v1.2.3