summaryrefslogtreecommitdiffstats
path: root/framework/src/domain/mime/tests/mailtemplatetest.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-10-08 13:36:05 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-10-08 13:36:05 +0200
commit5948dfeef0685477c9bd98f7d08508a6688c04d1 (patch)
tree09445799c8ee2e19aea1fa34fd460459681fa99c /framework/src/domain/mime/tests/mailtemplatetest.cpp
parent1913df64d2d9a19f1e0e7ae92a4e90c95e17d777 (diff)
downloadkube-5948dfeef0685477c9bd98f7d08508a6688c04d1.tar.gz
kube-5948dfeef0685477c9bd98f7d08508a6688c04d1.zip
Assembling html mails
Diffstat (limited to 'framework/src/domain/mime/tests/mailtemplatetest.cpp')
-rw-r--r--framework/src/domain/mime/tests/mailtemplatetest.cpp30
1 files changed, 26 insertions, 4 deletions
diff --git a/framework/src/domain/mime/tests/mailtemplatetest.cpp b/framework/src/domain/mime/tests/mailtemplatetest.cpp
index 700ae7a3..0ea5305f 100644
--- a/framework/src/domain/mime/tests/mailtemplatetest.cpp
+++ b/framework/src/domain/mime/tests/mailtemplatetest.cpp
@@ -225,7 +225,7 @@ private slots:
225 QString body = "body"; 225 QString body = "body";
226 QList<Attachment> attachments; 226 QList<Attachment> attachments;
227 227
228 auto result = MailTemplates::createMessage({}, to, cc, bcc, from, subject, body, attachments); 228 auto result = MailTemplates::createMessage({}, to, cc, bcc, from, subject, body, false, attachments);
229 229
230 QVERIFY(result); 230 QVERIFY(result);
231 QCOMPARE(result->subject()->asUnicodeString(), subject); 231 QCOMPARE(result->subject()->asUnicodeString(), subject);
@@ -234,6 +234,28 @@ private slots:
234 QVERIFY(result->contentType()->isMimeType("text/plain")); 234 QVERIFY(result->contentType()->isMimeType("text/plain"));
235 } 235 }
236 236
237 void testCreateHtmlMail()
238 {
239 QStringList to = {{"to@example.org"}};
240 QStringList cc = {{"cc@example.org"}};
241 QStringList bcc = {{"bcc@example.org"}};;
242 KMime::Types::Mailbox from;
243 from.fromUnicodeString("from@example.org");
244 QString subject = "subject";
245 QString body = "body";
246 QList<Attachment> attachments;
247
248 auto result = MailTemplates::createMessage({}, to, cc, bcc, from, subject, body, true, attachments);
249
250 QVERIFY(result);
251 QCOMPARE(result->subject()->asUnicodeString(), subject);
252 QVERIFY(result->date(false)->dateTime().isValid());
253 QVERIFY(result->contentType()->isMimeType("multipart/alternative"));
254 const auto contents = result->contents();
255 //1 Plain + 1 Html
256 QCOMPARE(contents.size(), 2);
257 }
258
237 void testCreatePlainMailWithAttachments() 259 void testCreatePlainMailWithAttachments()
238 { 260 {
239 QStringList to = {{"to@example.org"}}; 261 QStringList to = {{"to@example.org"}};
@@ -245,7 +267,7 @@ private slots:
245 QString body = "body"; 267 QString body = "body";
246 QList<Attachment> attachments = {{"name", "filename", "mimetype", true, "inlineAttachment"}, {"name", "filename", "mimetype", false, "nonInlineAttachment"}}; 268 QList<Attachment> attachments = {{"name", "filename", "mimetype", true, "inlineAttachment"}, {"name", "filename", "mimetype", false, "nonInlineAttachment"}};
247 269
248 auto result = MailTemplates::createMessage({}, to, cc, bcc, from, subject, body, attachments); 270 auto result = MailTemplates::createMessage({}, to, cc, bcc, from, subject, body, false, attachments);
249 271
250 QVERIFY(result); 272 QVERIFY(result);
251 QCOMPARE(result->subject()->asUnicodeString(), subject); 273 QCOMPARE(result->subject()->asUnicodeString(), subject);
@@ -269,7 +291,7 @@ private slots:
269 291
270 std::vector<GpgME::Key> keys = getKeys(); 292 std::vector<GpgME::Key> keys = getKeys();
271 293
272 auto result = MailTemplates::createMessage({}, to, cc, bcc, from, subject, body, attachments, keys); 294 auto result = MailTemplates::createMessage({}, to, cc, bcc, from, subject, body, false, attachments, keys);
273 295
274 QVERIFY(result); 296 QVERIFY(result);
275 // qWarning() << "---------------------------------"; 297 // qWarning() << "---------------------------------";
@@ -304,7 +326,7 @@ private slots:
304 326
305 std::vector<GpgME::Key> keys = getKeys(); 327 std::vector<GpgME::Key> keys = getKeys();
306 328
307 auto result = MailTemplates::createMessage({}, to, cc, bcc, from, subject, body, attachments, keys); 329 auto result = MailTemplates::createMessage({}, to, cc, bcc, from, subject, body, false, attachments, keys);
308 330
309 QVERIFY(result); 331 QVERIFY(result);
310 QCOMPARE(result->subject()->asUnicodeString(), subject); 332 QCOMPARE(result->subject()->asUnicodeString(), subject);