diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-08-02 16:58:14 -0600 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-08-02 16:58:14 -0600 |
commit | dd5b2a520f44df65fd88cf8c4040905054adaee1 (patch) | |
tree | 202cb8bf5ffe3b71f2b776715db7a71c93b7e355 /framework/src/domain/mime/tests/mailtemplatetest.cpp | |
parent | 64436e0787382d5c7fb3dae5b6128e1d93a77979 (diff) | |
download | kube-dd5b2a520f44df65fd88cf8c4040905054adaee1.tar.gz kube-dd5b2a520f44df65fd88cf8c4040905054adaee1.zip |
mailtests
Diffstat (limited to 'framework/src/domain/mime/tests/mailtemplatetest.cpp')
-rw-r--r-- | framework/src/domain/mime/tests/mailtemplatetest.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/framework/src/domain/mime/tests/mailtemplatetest.cpp b/framework/src/domain/mime/tests/mailtemplatetest.cpp index f393f1bd..eccb3aa7 100644 --- a/framework/src/domain/mime/tests/mailtemplatetest.cpp +++ b/framework/src/domain/mime/tests/mailtemplatetest.cpp | |||
@@ -126,6 +126,28 @@ private slots: | |||
126 | QVERIFY(result->date(false)->dateTime().isValid()); | 126 | QVERIFY(result->date(false)->dateTime().isValid()); |
127 | } | 127 | } |
128 | 128 | ||
129 | void testCreatePlainMailWithAttachments() | ||
130 | { | ||
131 | QStringList to = {{"to@example.org"}}; | ||
132 | QStringList cc = {{"cc@example.org"}};; | ||
133 | QStringList bcc = {{"bcc@example.org"}};; | ||
134 | KMime::Types::Mailbox from; | ||
135 | from.fromUnicodeString("from@example.org"); | ||
136 | QString subject = "subject"; | ||
137 | QString body = "body"; | ||
138 | QList<Attachment> attachments = {{"name", "filename", "mimetype", true, "inlineAttachment"}, {"name", "filename", "mimetype", false, "nonInlineAttachment"}}; | ||
139 | |||
140 | auto result = MailTemplates::createMessage({}, to, cc, bcc, from, subject, body, attachments); | ||
141 | |||
142 | QVERIFY(result); | ||
143 | auto content = removeFirstLine(result->body()); | ||
144 | QCOMPARE(result->subject()->asUnicodeString(), subject); | ||
145 | QVERIFY(result->contentType()->isMimeType("multipart/mixed")); | ||
146 | QVERIFY(result->date(false)->dateTime().isValid()); | ||
147 | const auto contents = result->contents(); | ||
148 | //1 Plain + 2 Attachments | ||
149 | QCOMPARE(contents.size(), 3); | ||
150 | } | ||
129 | }; | 151 | }; |
130 | 152 | ||
131 | QTEST_MAIN(MailTemplateTest) | 153 | QTEST_MAIN(MailTemplateTest) |