diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-08-02 16:52:45 -0600 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-08-02 16:52:45 -0600 |
commit | 64436e0787382d5c7fb3dae5b6128e1d93a77979 (patch) | |
tree | d3a1b18fc278f908a88373eba77c9187db924efa /framework/src/domain/mime/tests/mailtemplatetest.cpp | |
parent | 105474a893bfc6b6cd9fb86cb7b6bb6e39bb23e0 (diff) | |
download | kube-64436e0787382d5c7fb3dae5b6128e1d93a77979.tar.gz kube-64436e0787382d5c7fb3dae5b6128e1d93a77979.zip |
Moved mailcomposing into mailtemplates
so we can start testing it.
Diffstat (limited to 'framework/src/domain/mime/tests/mailtemplatetest.cpp')
-rw-r--r-- | framework/src/domain/mime/tests/mailtemplatetest.cpp | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/framework/src/domain/mime/tests/mailtemplatetest.cpp b/framework/src/domain/mime/tests/mailtemplatetest.cpp index e9752c9e..f393f1bd 100644 --- a/framework/src/domain/mime/tests/mailtemplatetest.cpp +++ b/framework/src/domain/mime/tests/mailtemplatetest.cpp | |||
@@ -58,7 +58,7 @@ private slots: | |||
58 | QtWebEngine::initialize(); | 58 | QtWebEngine::initialize(); |
59 | } | 59 | } |
60 | 60 | ||
61 | void testPlain() | 61 | void testPlainReply() |
62 | { | 62 | { |
63 | auto msg = readMail("plaintext.mbox"); | 63 | auto msg = readMail("plaintext.mbox"); |
64 | KMime::Message::Ptr result; | 64 | KMime::Message::Ptr result; |
@@ -69,7 +69,7 @@ private slots: | |||
69 | QCOMPARE(normalize(removeFirstLine(result->body())), normalize(msg->body())); | 69 | QCOMPARE(normalize(removeFirstLine(result->body())), normalize(msg->body())); |
70 | } | 70 | } |
71 | 71 | ||
72 | void testHtml() | 72 | void testHtmlReply() |
73 | { | 73 | { |
74 | auto msg = readMail("html.mbox"); | 74 | auto msg = readMail("html.mbox"); |
75 | KMime::Message::Ptr result; | 75 | KMime::Message::Ptr result; |
@@ -80,7 +80,7 @@ private slots: | |||
80 | QCOMPARE(unquote(removeFirstLine(result->body())), QLatin1String("HTML text")); | 80 | QCOMPARE(unquote(removeFirstLine(result->body())), QLatin1String("HTML text")); |
81 | } | 81 | } |
82 | 82 | ||
83 | void testMultipartSigned() | 83 | void testMultipartSignedReply() |
84 | { | 84 | { |
85 | auto msg = readMail("openpgp-signed-mailinglist.mbox"); | 85 | auto msg = readMail("openpgp-signed-mailinglist.mbox"); |
86 | KMime::Message::Ptr result; | 86 | KMime::Message::Ptr result; |
@@ -93,7 +93,7 @@ private slots: | |||
93 | QVERIFY(content.contains("i noticed a new branch")); | 93 | QVERIFY(content.contains("i noticed a new branch")); |
94 | } | 94 | } |
95 | 95 | ||
96 | void testMultipartAlternative() | 96 | void testMultipartAlternativeReply() |
97 | { | 97 | { |
98 | auto msg = readMail("alternative.mbox"); | 98 | auto msg = readMail("alternative.mbox"); |
99 | KMime::Message::Ptr result; | 99 | KMime::Message::Ptr result; |
@@ -106,6 +106,26 @@ private slots: | |||
106 | QCOMPARE(unquote(content), QLatin1String("If you can see this text it means that your email client couldn't display our newsletter properly.\nPlease visit this link to view the newsletter on our website: http://www.gog.com/newsletter/\n")); | 106 | QCOMPARE(unquote(content), QLatin1String("If you can see this text it means that your email client couldn't display our newsletter properly.\nPlease visit this link to view the newsletter on our website: http://www.gog.com/newsletter/\n")); |
107 | } | 107 | } |
108 | 108 | ||
109 | void testCreatePlainMail() | ||
110 | { | ||
111 | QStringList to = {{"to@example.org"}}; | ||
112 | QStringList cc = {{"cc@example.org"}};; | ||
113 | QStringList bcc = {{"bcc@example.org"}};; | ||
114 | KMime::Types::Mailbox from; | ||
115 | from.fromUnicodeString("from@example.org"); | ||
116 | QString subject = "subject"; | ||
117 | QString body = "body"; | ||
118 | QList<Attachment> attachments; | ||
119 | |||
120 | auto result = MailTemplates::createMessage({}, to, cc, bcc, from, subject, body, attachments); | ||
121 | |||
122 | QVERIFY(result); | ||
123 | auto content = removeFirstLine(result->body()); | ||
124 | QCOMPARE(result->subject()->asUnicodeString(), subject); | ||
125 | QCOMPARE(result->body(), body.toUtf8()); | ||
126 | QVERIFY(result->date(false)->dateTime().isValid()); | ||
127 | } | ||
128 | |||
109 | }; | 129 | }; |
110 | 130 | ||
111 | QTEST_MAIN(MailTemplateTest) | 131 | QTEST_MAIN(MailTemplateTest) |