diff options
Diffstat (limited to 'examples/mailtransportresource/tests')
-rw-r--r-- | examples/mailtransportresource/tests/mailtransporttest.cpp | 17 |
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 | ||
31 | private slots: | 32 | private 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. |