From b7e18a461fd14ec34723d689f644880964314f1b Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 3 Aug 2017 10:00:35 -0600 Subject: Commit missing files --- .../src/domain/mime/tests/mailtemplatetest.cpp | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'framework/src/domain/mime/tests') diff --git a/framework/src/domain/mime/tests/mailtemplatetest.cpp b/framework/src/domain/mime/tests/mailtemplatetest.cpp index 62b17a6c..e814f75f 100644 --- a/framework/src/domain/mime/tests/mailtemplatetest.cpp +++ b/framework/src/domain/mime/tests/mailtemplatetest.cpp @@ -214,6 +214,36 @@ private slots: qWarning() << "---------------------------------"; QCOMPARE(result->subject()->asUnicodeString(), subject); QVERIFY(result->contentType()->isMimeType("multipart/signed")); + + const auto contents = result->contents(); + QCOMPARE(contents.size(), 2); + { + auto c = contents.at(0); + QVERIFY(c->contentType()->isMimeType("text/plain")); + } + { + auto c = contents.at(1); + QVERIFY(c->contentType()->isMimeType("application/pgp-signature")); + } + } + + void testCreatePlainMailWithAttachmentsSigned() + { + QStringList to = {{"to@example.org"}}; + QStringList cc = {{"cc@example.org"}};; + QStringList bcc = {{"bcc@example.org"}};; + KMime::Types::Mailbox from; + from.fromUnicodeString("from@example.org"); + QString subject = "subject"; + QString body = "body"; + QList attachments = {{"name", "filename", "mimetype", true, "inlineAttachment"}, {"name", "filename", "mimetype", false, "nonInlineAttachment"}}; + + std::vector keys = getKeys(); + + auto result = MailTemplates::createMessage({}, to, cc, bcc, from, subject, body, attachments, keys); + + QVERIFY(result); + QVERIFY(result->contentType()->isMimeType("multipart/signed")); } }; -- cgit v1.2.3