From 20b76fc1fd539bf95b8cb0d0ea7044718ec99972 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 6 Dec 2016 19:31:31 +0100 Subject: Move mail to sent folder after sending it --- .../mailtransportresource/tests/mailtransporttest.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'examples/mailtransportresource/tests') diff --git a/examples/mailtransportresource/tests/mailtransporttest.cpp b/examples/mailtransportresource/tests/mailtransporttest.cpp index 410e17b..cb78603 100644 --- a/examples/mailtransportresource/tests/mailtransporttest.cpp +++ b/examples/mailtransportresource/tests/mailtransporttest.cpp @@ -27,6 +27,7 @@ class MailtransportTest : public QObject return resource; } QByteArray mResourceInstanceIdentifier; + QByteArray mStorageResource; private slots: @@ -37,6 +38,11 @@ private slots: QVERIFY(!resource.identifier().isEmpty()); VERIFYEXEC(Store::create(resource)); mResourceInstanceIdentifier = resource.identifier(); + + auto dummyResource = ApplicationDomain::DummyResource::create("account1"); + VERIFYEXEC(Store::create(dummyResource)); + mStorageResource = dummyResource.identifier(); + QVERIFY(!mStorageResource.isEmpty()); } void cleanup() @@ -61,11 +67,12 @@ private slots: VERIFYEXEC(Store::create(mail)); VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); VERIFYEXEC(Store::synchronize(Query().resourceFilter(mResourceInstanceIdentifier))); - VERIFYEXEC(ResourceControl::inspect(ResourceControl::Inspection::ExistenceInspection(mail, true))); - - auto sentMail = Store::readOne(Query(mail).request().request()); - QVERIFY(sentMail.getSent()); - QVERIFY(!sentMail.getSubject().isEmpty()); + QTest::qWait(100); + VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mStorageResource)); + auto mailInSentMailFolder = Store::readOne(Query().resourceFilter(mStorageResource).filter(true).request().request().request().request()); + //Check that the mail has been moved to the sent mail folder + QVERIFY(mailInSentMailFolder.getSent()); + QVERIFY(!mailInSentMailFolder.getSubject().isEmpty()); } //TODO test mail that fails to be sent. add a special header to the mail and have the resource fail sending. Ensure we can modify the mail to fix sending of the message. -- cgit v1.2.3