summaryrefslogtreecommitdiffstats
path: root/examples/mailtransportresource/tests
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-12-06 19:31:31 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-12-06 19:31:31 +0100
commit20b76fc1fd539bf95b8cb0d0ea7044718ec99972 (patch)
tree03da4339c8879e4d45e0c5a903b6bfb410c4bf31 /examples/mailtransportresource/tests
parent62c7b07c0d62f8f03e22556bf62ed90d267c6d2e (diff)
downloadsink-20b76fc1fd539bf95b8cb0d0ea7044718ec99972.tar.gz
sink-20b76fc1fd539bf95b8cb0d0ea7044718ec99972.zip
Move mail to sent folder after sending it
Diffstat (limited to 'examples/mailtransportresource/tests')
-rw-r--r--examples/mailtransportresource/tests/mailtransporttest.cpp17
1 files changed, 12 insertions, 5 deletions
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
27 return resource; 27 return resource;
28 } 28 }
29 QByteArray mResourceInstanceIdentifier; 29 QByteArray mResourceInstanceIdentifier;
30 QByteArray mStorageResource;
30 31
31private slots: 32private slots:
32 33
@@ -37,6 +38,11 @@ private slots:
37 QVERIFY(!resource.identifier().isEmpty()); 38 QVERIFY(!resource.identifier().isEmpty());
38 VERIFYEXEC(Store::create(resource)); 39 VERIFYEXEC(Store::create(resource));
39 mResourceInstanceIdentifier = resource.identifier(); 40 mResourceInstanceIdentifier = resource.identifier();
41
42 auto dummyResource = ApplicationDomain::DummyResource::create("account1");
43 VERIFYEXEC(Store::create(dummyResource));
44 mStorageResource = dummyResource.identifier();
45 QVERIFY(!mStorageResource.isEmpty());
40 } 46 }
41 47
42 void cleanup() 48 void cleanup()
@@ -61,11 +67,12 @@ private slots:
61 VERIFYEXEC(Store::create(mail)); 67 VERIFYEXEC(Store::create(mail));
62 VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); 68 VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier));
63 VERIFYEXEC(Store::synchronize(Query().resourceFilter(mResourceInstanceIdentifier))); 69 VERIFYEXEC(Store::synchronize(Query().resourceFilter(mResourceInstanceIdentifier)));
64 VERIFYEXEC(ResourceControl::inspect<ApplicationDomain::Mail>(ResourceControl::Inspection::ExistenceInspection(mail, true))); 70 QTest::qWait(100);
65 71 VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mStorageResource));
66 auto sentMail = Store::readOne<ApplicationDomain::Mail>(Query(mail).request<Mail::Sent>().request<Mail::Subject>()); 72 auto mailInSentMailFolder = Store::readOne<ApplicationDomain::Mail>(Query().resourceFilter(mStorageResource).filter<Mail::Sent>(true).request<Mail::Subject>().request<Mail::Folder>().request<Mail::MimeMessage>().request<Mail::Sent>());
67 QVERIFY(sentMail.getSent()); 73 //Check that the mail has been moved to the sent mail folder
68 QVERIFY(!sentMail.getSubject().isEmpty()); 74 QVERIFY(mailInSentMailFolder.getSent());
75 QVERIFY(!mailInSentMailFolder.getSubject().isEmpty());
69 } 76 }
70 77
71 //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. 78 //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.