From 67e83aadde8db2bb1293cee61e8c6306a4ffcca0 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 18 Jan 2016 18:36:41 +0100 Subject: Working resource inspection --- tests/clientapitest.cpp | 1 + tests/inspectiontest.cpp | 25 +++++++++++++------------ 2 files changed, 14 insertions(+), 12 deletions(-) (limited to 'tests') diff --git a/tests/clientapitest.cpp b/tests/clientapitest.cpp index 5942849..86150ee 100644 --- a/tests/clientapitest.cpp +++ b/tests/clientapitest.cpp @@ -33,6 +33,7 @@ public: KAsync::Job create(const T &domainObject) Q_DECL_OVERRIDE { return KAsync::null(); }; KAsync::Job modify(const T &domainObject) Q_DECL_OVERRIDE { return KAsync::null(); }; KAsync::Job remove(const T &domainObject) Q_DECL_OVERRIDE { return KAsync::null(); }; + KAsync::Job inspect(const Akonadi2::Inspection &) Q_DECL_OVERRIDE { return KAsync::null(); }; QPair, typename Akonadi2::ResultEmitter::Ptr > load(const Akonadi2::Query &query) Q_DECL_OVERRIDE { auto resultProvider = new Akonadi2::ResultProvider(); diff --git a/tests/inspectiontest.cpp b/tests/inspectiontest.cpp index e332844..29cce6c 100644 --- a/tests/inspectiontest.cpp +++ b/tests/inspectiontest.cpp @@ -4,11 +4,7 @@ #include "dummyresource/resourcefactory.h" #include "clientapi.h" -#include "commands.h" -#include "entitybuffer.h" #include "resourceconfig.h" -#include "modelresult.h" -#include "pipeline.h" #include "log.h" /** @@ -38,25 +34,30 @@ private Q_SLOTS: Akonadi2::Store::start(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); } - void init() + void testInspection_data() { - qDebug(); - qDebug() << "-----------------------------------------"; - qDebug(); + QTest::addColumn("success"); + QTest::newRow("success") << true; + QTest::newRow("fail") << false; } - void testMarkMailAsRead() + void testInspection() { + QFETCH(bool, success); using namespace Akonadi2; using namespace Akonadi2::ApplicationDomain; Mail mail(QByteArray("org.kde.dummy.instance1"), QByteArray("identifier"), 0, QSharedPointer::create()); - auto inspectionCommand = Resources::Inspection::PropertyInspection(mail, "unread", true); + //testInspection is a magic property that the dummyresource supports + auto inspectionCommand = Resources::Inspection::PropertyInspection(mail, "testInspection", success); auto result = Resources::inspect(inspectionCommand).exec(); result.waitForFinished(); - QVERIFY(!result.errorCode()); - Akonadi2::Store::flushMessageQueue(QByteArrayList() << QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); + if (success) { + QVERIFY(!result.errorCode()); + } else { + QVERIFY(result.errorCode()); + } } }; -- cgit v1.2.3