summaryrefslogtreecommitdiffstats
path: root/examples/imapresource/tests
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2018-01-23 14:24:30 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2018-01-23 14:24:30 +0100
commit5ef044eab02e1e8429a05b45398566ad81124fb6 (patch)
tree4723f9def75b89be2bbf57f8fa36dcbbf05ad824 /examples/imapresource/tests
parent5df2b7c593594e61e403273c44ceae29207448c4 (diff)
downloadsink-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.
Diffstat (limited to 'examples/imapresource/tests')
-rw-r--r--examples/imapresource/tests/imapserverproxytest.cpp19
-rw-r--r--examples/imapresource/tests/resetmailbox.sh4
2 files changed, 19 insertions, 4 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
9sudo echo "cm user.doe.Trash" | cyradm --auth PLAIN -u cyrus -w admin localhost 9sudo echo "cm user.doe.Trash" | cyradm --auth PLAIN -u cyrus -w admin localhost
10sudo echo "subscribe INBOX.Trash" | cyradm --auth PLAIN -u doe -w doe localhost 10sudo echo "subscribe INBOX.Trash" | cyradm --auth PLAIN -u doe -w doe localhost
11sudo echo "sam user.doe cyrus c" | cyradm --auth PLAIN -u cyrus -w admin localhost 11sudo echo "sam user.doe cyrus c" | cyradm --auth PLAIN -u cyrus -w admin localhost
12FOLDERPATH=/var/spool/imap/d/user/doe/test
13sudo cp /src/sink/examples/imapresource/tests/data/1365777830.R28.localhost.localdomain\:2\,S $FOLDERPATH/1.
14sudo chown cyrus:mail $FOLDERPATH/1.
15sudo reconstruct "user.doe.test"