diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-05-17 21:18:10 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-05-17 21:18:10 +0200 |
commit | 5cb860c194ae08d560156c35309a0a14794a4bda (patch) | |
tree | ebee24ba60e7f6f262baae4ee4ba90e2aec2ed9f /framework/src/domain/mime/tests/mailtemplatetest.cpp | |
parent | 455809b0e5d6e80406867aa8f5a74aa10a39bf35 (diff) | |
download | kube-5cb860c194ae08d560156c35309a0a14794a4bda.tar.gz kube-5cb860c194ae08d560156c35309a0a14794a4bda.zip |
Re-enable ASCII armoring
That was disabled accidentally during the port to gpgme.
Diffstat (limited to 'framework/src/domain/mime/tests/mailtemplatetest.cpp')
-rw-r--r-- | framework/src/domain/mime/tests/mailtemplatetest.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/framework/src/domain/mime/tests/mailtemplatetest.cpp b/framework/src/domain/mime/tests/mailtemplatetest.cpp index 20ea8c5e..508af9aa 100644 --- a/framework/src/domain/mime/tests/mailtemplatetest.cpp +++ b/framework/src/domain/mime/tests/mailtemplatetest.cpp | |||
@@ -63,6 +63,17 @@ static QString unquote(const QString &s) | |||
63 | class MailTemplateTest : public QObject | 63 | class MailTemplateTest : public QObject |
64 | { | 64 | { |
65 | Q_OBJECT | 65 | Q_OBJECT |
66 | |||
67 | bool validate(KMime::Message::Ptr msg) | ||
68 | { | ||
69 | const auto data = msg->encodedContent(); | ||
70 | //IMAP compat: The ASCII NUL character, %x00, MUST NOT be used at any time. | ||
71 | if (data.contains('\0')) { | ||
72 | return false; | ||
73 | } | ||
74 | return true; | ||
75 | } | ||
76 | |||
66 | private slots: | 77 | private slots: |
67 | 78 | ||
68 | void initTestCase() | 79 | void initTestCase() |
@@ -268,6 +279,7 @@ private slots: | |||
268 | auto result = MailTemplates::createMessage({}, to, cc, bcc, from, subject, body, false, attachments); | 279 | auto result = MailTemplates::createMessage({}, to, cc, bcc, from, subject, body, false, attachments); |
269 | 280 | ||
270 | QVERIFY(result); | 281 | QVERIFY(result); |
282 | QVERIFY(validate(result)); | ||
271 | QCOMPARE(result->subject()->asUnicodeString(), subject); | 283 | QCOMPARE(result->subject()->asUnicodeString(), subject); |
272 | QCOMPARE(result->body(), body.toUtf8()); | 284 | QCOMPARE(result->body(), body.toUtf8()); |
273 | QVERIFY(result->date(false)->dateTime().isValid()); | 285 | QVERIFY(result->date(false)->dateTime().isValid()); |
@@ -289,6 +301,7 @@ private slots: | |||
289 | auto result = MailTemplates::createMessage({}, to, cc, bcc, from, subject, body, true, attachments); | 301 | auto result = MailTemplates::createMessage({}, to, cc, bcc, from, subject, body, true, attachments); |
290 | 302 | ||
291 | QVERIFY(result); | 303 | QVERIFY(result); |
304 | QVERIFY(validate(result)); | ||
292 | QCOMPARE(result->subject()->asUnicodeString(), subject); | 305 | QCOMPARE(result->subject()->asUnicodeString(), subject); |
293 | QVERIFY(result->date(false)->dateTime().isValid()); | 306 | QVERIFY(result->date(false)->dateTime().isValid()); |
294 | QVERIFY(result->contentType()->isMimeType("multipart/alternative")); | 307 | QVERIFY(result->contentType()->isMimeType("multipart/alternative")); |
@@ -311,6 +324,7 @@ private slots: | |||
311 | auto result = MailTemplates::createMessage({}, to, cc, bcc, from, subject, body, false, attachments); | 324 | auto result = MailTemplates::createMessage({}, to, cc, bcc, from, subject, body, false, attachments); |
312 | 325 | ||
313 | QVERIFY(result); | 326 | QVERIFY(result); |
327 | QVERIFY(validate(result)); | ||
314 | QCOMPARE(result->subject()->asUnicodeString(), subject); | 328 | QCOMPARE(result->subject()->asUnicodeString(), subject); |
315 | QVERIFY(result->contentType()->isMimeType("multipart/mixed")); | 329 | QVERIFY(result->contentType()->isMimeType("multipart/mixed")); |
316 | QVERIFY(result->date(false)->dateTime().isValid()); | 330 | QVERIFY(result->date(false)->dateTime().isValid()); |
@@ -335,6 +349,7 @@ private slots: | |||
335 | auto result = MailTemplates::createMessage({}, to, cc, bcc, from, subject, body, true, attachments); | 349 | auto result = MailTemplates::createMessage({}, to, cc, bcc, from, subject, body, true, attachments); |
336 | 350 | ||
337 | QVERIFY(result); | 351 | QVERIFY(result); |
352 | QVERIFY(validate(result)); | ||
338 | QCOMPARE(result->subject()->asUnicodeString(), subject); | 353 | QCOMPARE(result->subject()->asUnicodeString(), subject); |
339 | QVERIFY(result->contentType()->isMimeType("multipart/mixed")); | 354 | QVERIFY(result->contentType()->isMimeType("multipart/mixed")); |
340 | QVERIFY(result->date(false)->dateTime().isValid()); | 355 | QVERIFY(result->date(false)->dateTime().isValid()); |
@@ -360,6 +375,7 @@ private slots: | |||
360 | auto result = MailTemplates::createMessage({}, to, cc, bcc, from, subject, body, false, attachments, keys, {}, keys[0]); | 375 | auto result = MailTemplates::createMessage({}, to, cc, bcc, from, subject, body, false, attachments, keys, {}, keys[0]); |
361 | 376 | ||
362 | QVERIFY(result); | 377 | QVERIFY(result); |
378 | QVERIFY(validate(result)); | ||
363 | // qWarning() << "---------------------------------"; | 379 | // qWarning() << "---------------------------------"; |
364 | // qWarning().noquote() << result->encodedContent(); | 380 | // qWarning().noquote() << result->encodedContent(); |
365 | // qWarning() << "---------------------------------"; | 381 | // qWarning() << "---------------------------------"; |
@@ -401,6 +417,7 @@ private slots: | |||
401 | auto result = MailTemplates::createMessage({}, to, cc, bcc, from, subject, body, false, attachments, Crypto::findKeys({}, true, false)); | 417 | auto result = MailTemplates::createMessage({}, to, cc, bcc, from, subject, body, false, attachments, Crypto::findKeys({}, true, false)); |
402 | 418 | ||
403 | QVERIFY(result); | 419 | QVERIFY(result); |
420 | QVERIFY(validate(result)); | ||
404 | QCOMPARE(result->subject()->asUnicodeString(), subject); | 421 | QCOMPARE(result->subject()->asUnicodeString(), subject); |
405 | QVERIFY(result->date(false)->dateTime().isValid()); | 422 | QVERIFY(result->date(false)->dateTime().isValid()); |
406 | 423 | ||