diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-01-23 14:24:30 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-01-23 14:24:30 +0100 |
commit | 5ef044eab02e1e8429a05b45398566ad81124fb6 (patch) | |
tree | 4723f9def75b89be2bbf57f8fa36dcbbf05ad824 | |
parent | 5df2b7c593594e61e403273c44ceae29207448c4 (diff) | |
download | sink-5ef044eab02e1e8429a05b45398566ad81124fb6.tar.gz sink-5ef044eab02e1e8429a05b45398566ad81124fb6.zip |
Fixed imap tests
Adding the mail to cyrus imap somehow broke with cyrus 3.0.
We're now creating the mail instead, before trying to sync it.
4 files changed, 26 insertions, 77 deletions
diff --git a/examples/imapresource/tests/imapserverproxytest.cpp b/examples/imapresource/tests/imapserverproxytest.cpp index 999665f..f524d51 100644 --- a/examples/imapresource/tests/imapserverproxytest.cpp +++ b/examples/imapresource/tests/imapserverproxytest.cpp | |||
@@ -81,6 +81,25 @@ private slots: | |||
81 | VERIFYEXEC_FAIL(imap.fetchFolders([](const Folder &){})); | 81 | VERIFYEXEC_FAIL(imap.fetchFolders([](const Folder &){})); |
82 | } | 82 | } |
83 | 83 | ||
84 | void testAppendMail() | ||
85 | { | ||
86 | ImapServerProxy imap("localhost", 143, Imap::EncryptionMode::NoEncryption); | ||
87 | VERIFYEXEC(imap.login("doe", "doe")); | ||
88 | |||
89 | |||
90 | auto mail = KMime::Message::Ptr::create(); | ||
91 | mail->from(true)->from7BitString("<doe@example.org>"); | ||
92 | mail->to(true)->from7BitString("<doe@example.org>"); | ||
93 | mail->subject(true)->from7BitString("subject"); | ||
94 | mail->setBody("Body"); | ||
95 | auto content = mail->encodedContent(true); | ||
96 | |||
97 | KIMAP2::MessageFlags flags; | ||
98 | flags << Imap::Flags::Seen; | ||
99 | flags << Imap::Flags::Flagged; | ||
100 | VERIFYEXEC(imap.append("INBOX.test", content, flags, QDateTime::currentDateTimeUtc())); | ||
101 | } | ||
102 | |||
84 | void testFetchMail() | 103 | void testFetchMail() |
85 | { | 104 | { |
86 | ImapServerProxy imap("localhost", 143, Imap::EncryptionMode::NoEncryption); | 105 | ImapServerProxy imap("localhost", 143, Imap::EncryptionMode::NoEncryption); |
diff --git a/examples/imapresource/tests/resetmailbox.sh b/examples/imapresource/tests/resetmailbox.sh index 8e6b1b1..b216ee4 100644 --- a/examples/imapresource/tests/resetmailbox.sh +++ b/examples/imapresource/tests/resetmailbox.sh | |||
@@ -9,7 +9,3 @@ sudo echo "subscribe INBOX.Drafts" | cyradm --auth PLAIN -u doe -w doe localhost | |||
9 | sudo echo "cm user.doe.Trash" | cyradm --auth PLAIN -u cyrus -w admin localhost | 9 | sudo echo "cm user.doe.Trash" | cyradm --auth PLAIN -u cyrus -w admin localhost |
10 | sudo echo "subscribe INBOX.Trash" | cyradm --auth PLAIN -u doe -w doe localhost | 10 | sudo echo "subscribe INBOX.Trash" | cyradm --auth PLAIN -u doe -w doe localhost |
11 | sudo echo "sam user.doe cyrus c" | cyradm --auth PLAIN -u cyrus -w admin localhost | 11 | sudo echo "sam user.doe cyrus c" | cyradm --auth PLAIN -u cyrus -w admin localhost |
12 | FOLDERPATH=/var/spool/imap/d/user/doe/test | ||
13 | sudo cp /src/sink/examples/imapresource/tests/data/1365777830.R28.localhost.localdomain\:2\,S $FOLDERPATH/1. | ||
14 | sudo chown cyrus:mail $FOLDERPATH/1. | ||
15 | sudo reconstruct "user.doe.test" | ||
diff --git a/examples/maildirresource/tests/data/maildir1/test/cur/1365777830.R28.localhost.localdomain:2,S b/examples/maildirresource/tests/data/maildir1/test/cur/1365777830.R28.localhost.localdomain:2,S deleted file mode 100644 index 91231b5..0000000 --- a/examples/maildirresource/tests/data/maildir1/test/cur/1365777830.R28.localhost.localdomain:2,S +++ /dev/null | |||
@@ -1,72 +0,0 @@ | |||
1 | Return-Path: <nepomuk-bounces@kde.org> | ||
2 | Received: from compute4.internal (compute4.nyi.mail.srv.osa [10.202.2.44]) | ||
3 | by slots3a1p1 (Cyrus git2.5+0-git-fastmail-8998) with LMTPA; | ||
4 | Mon, 11 Mar 2013 14:28:42 -0400 | ||
5 | X-Sieve: CMU Sieve 2.4 | ||
6 | X-Spam-score: 0.0 | ||
7 | X-Spam-hits: BAYES_00 -1.9, RCVD_IN_DNSWL_MED -2.3, RP_MATCHES_RCVD -0.704, | ||
8 | LANGUAGES unknown, BAYES_USED global, SA_VERSION 3.3.1 | ||
9 | X-Spam-source: IP='46.4.96.248', Host='postbox.kde.org', Country='unk', FromHeader='org', | ||
10 | MailFrom='org' | ||
11 | X-Spam-charsets: plain='us-ascii' | ||
12 | X-Resolved-to: chrigi_1@fastmail.fm | ||
13 | X-Delivered-to: chrigi_1@fastmail.fm | ||
14 | X-Mail-from: nepomuk-bounces@kde.org | ||
15 | Received: from mx4.nyi.mail.srv.osa ([10.202.2.203]) | ||
16 | by compute4.internal (LMTPProxy); Mon, 11 Mar 2013 14:28:42 -0400 | ||
17 | Received: from postbox.kde.org (postbox.kde.org [46.4.96.248]) | ||
18 | by mx4.messagingengine.com (Postfix) with ESMTP id 1C9D2440F88 | ||
19 | for <chrigi_1@fastmail.fm>; Mon, 11 Mar 2013 14:28:42 -0400 (EDT) | ||
20 | Received: from postbox.kde.org (localhost [IPv6:::1]) | ||
21 | by postbox.kde.org (Postfix) with ESMTP id 00FFEB3732B; | ||
22 | Mon, 11 Mar 2013 18:28:40 +0000 (UTC) | ||
23 | DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=kde.org; s=default; | ||
24 | t=1363026520; bh=cOdvyBAJJ8ho64q0H7rxkl+cB2y6TiyVOX0fO3yZ64U=; | ||
25 | h=Date:From:To:Message-ID:In-Reply-To:References:MIME-Version: | ||
26 | Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help: | ||
27 | List-Subscribe:Content-Type:Content-Transfer-Encoding:Sender; b=dv | ||
28 | dJAFu+6JCuNun5WIuP4ysfKpLh0DeuhEEfy2cQavUGMICJ27k7tI73x6gN37V5Q/evJ | ||
29 | NDFna3/IhNBsAQeLiXs28HKxzcVhbnq5jdFR6fbyo6k1fOKt5vTT1GTDZ+3zIGPD1CU | ||
30 | ioDBGxPb/Ds6gee90tjadOj6o+Oc+2ZSq94= | ||
31 | X-Original-To: nepomuk@kde.org | ||
32 | X-Remote-Delivered-To: nepomuk@localhost.kde.org | ||
33 | Received: from build.kde.org (build.kde.org [IPv6:2a01:4f8:160:9363::5]) | ||
34 | by postbox.kde.org (Postfix) with ESMTP id 4491CB3732B | ||
35 | for <nepomuk@kde.org>; Mon, 11 Mar 2013 18:28:27 +0000 (UTC) | ||
36 | Received: from localhost ([127.0.0.1]) by build.kde.org with esmtp (Exim 4.72) | ||
37 | (envelope-from <null@kde.org>) id 1UF7SV-0000gs-11 | ||
38 | for nepomuk@kde.org; Mon, 11 Mar 2013 18:28:27 +0000 | ||
39 | Date: Mon, 11 Mar 2013 18:28:27 +0000 (UTC) | ||
40 | From: KDE CI System <null@kde.org> | ||
41 | To: nepomuk@kde.org | ||
42 | Message-ID: <1977027405.27.1363026507008.JavaMail.jenkins@build> | ||
43 | In-Reply-To: <880663748.26.1363026023717.JavaMail.jenkins@build> | ||
44 | References: <880663748.26.1363026023717.JavaMail.jenkins@build> | ||
45 | MIME-Version: 1.0 | ||
46 | X-Jenkins-Job: nepomuk-core_stable | ||
47 | X-Jenkins-Result: UNSTABLE | ||
48 | X-Scanned-By: MIMEDefang 2.71 on 46.4.96.248 | ||
49 | Subject: [Nepomuk] Jenkins build is still unstable: nepomuk-core_stable #158 | ||
50 | X-BeenThere: nepomuk@kde.org | ||
51 | X-Mailman-Version: 2.1.14 | ||
52 | Precedence: list | ||
53 | List-Id: The Semantic KDE <nepomuk.kde.org> | ||
54 | List-Unsubscribe: <https://mail.kde.org/mailman/options/nepomuk>, | ||
55 | <mailto:nepomuk-request@kde.org?subject=unsubscribe> | ||
56 | List-Archive: <http://mail.kde.org/pipermail/nepomuk> | ||
57 | List-Post: <mailto:nepomuk@kde.org> | ||
58 | List-Help: <mailto:nepomuk-request@kde.org?subject=help> | ||
59 | List-Subscribe: <https://mail.kde.org/mailman/listinfo/nepomuk>, | ||
60 | <mailto:nepomuk-request@kde.org?subject=subscribe> | ||
61 | Content-Type: text/plain; charset="us-ascii" | ||
62 | Content-Transfer-Encoding: 7bit | ||
63 | Errors-To: nepomuk-bounces@kde.org | ||
64 | Sender: nepomuk-bounces@kde.org | ||
65 | X-Truedomain: NotChecked | ||
66 | |||
67 | See <http://build.kde.org/job/nepomuk-core_stable/changes> | ||
68 | |||
69 | _______________________________________________ | ||
70 | Nepomuk mailing list | ||
71 | Nepomuk@kde.org | ||
72 | https://mail.kde.org/mailman/listinfo/nepomuk | ||
diff --git a/tests/mailsynctest.cpp b/tests/mailsynctest.cpp index 2d480f7..058cae4 100644 --- a/tests/mailsynctest.cpp +++ b/tests/mailsynctest.cpp | |||
@@ -261,6 +261,12 @@ void MailSyncTest::testListRemovedSubFolder() | |||
261 | 261 | ||
262 | void MailSyncTest::testListMails() | 262 | void MailSyncTest::testListMails() |
263 | { | 263 | { |
264 | auto msg = KMime::Message::Ptr::create(); | ||
265 | msg->subject(true)->fromUnicodeString("This is a Subject.", "utf8"); | ||
266 | msg->date(true)->setDateTime(QDateTime::currentDateTimeUtc()); | ||
267 | msg->assemble(); | ||
268 | createMessage(QStringList() << "test", msg->encodedContent(true)); | ||
269 | |||
264 | Sink::Query query; | 270 | Sink::Query query; |
265 | query.resourceFilter(mResourceInstanceIdentifier); | 271 | query.resourceFilter(mResourceInstanceIdentifier); |
266 | query.request<Mail::Subject>().request<Mail::MimeMessage>().request<Mail::Folder>().request<Mail::Date>(); | 272 | query.request<Mail::Subject>().request<Mail::MimeMessage>().request<Mail::Folder>().request<Mail::Date>(); |
@@ -272,7 +278,7 @@ void MailSyncTest::testListMails() | |||
272 | auto job = Store::fetchAll<Mail>(query).then([](const QList<Mail::Ptr> &mails) { | 278 | auto job = Store::fetchAll<Mail>(query).then([](const QList<Mail::Ptr> &mails) { |
273 | ASYNCCOMPARE(mails.size(), 1); | 279 | ASYNCCOMPARE(mails.size(), 1); |
274 | auto mail = mails.first(); | 280 | auto mail = mails.first(); |
275 | ASYNCVERIFY(mail->getSubject().startsWith(QString("[Nepomuk] Jenkins build is still unstable"))); | 281 | ASYNCVERIFY(mail->getSubject().startsWith(QString("This is a Subject."))); |
276 | const auto data = mail->getMimeMessage(); | 282 | const auto data = mail->getMimeMessage(); |
277 | ASYNCVERIFY(!data.isEmpty()); | 283 | ASYNCVERIFY(!data.isEmpty()); |
278 | 284 | ||