diff options
Diffstat (limited to 'examples/imapresource/tests')
-rw-r--r-- | examples/imapresource/tests/imapresourcetest.cpp | 27 | ||||
-rw-r--r-- | examples/imapresource/tests/imapserverproxytest.cpp | 6 | ||||
-rw-r--r-- | examples/imapresource/tests/resetmailbox.sh | 6 |
3 files changed, 33 insertions, 6 deletions
diff --git a/examples/imapresource/tests/imapresourcetest.cpp b/examples/imapresource/tests/imapresourcetest.cpp index d8fc46e..8ce32c2 100644 --- a/examples/imapresource/tests/imapresourcetest.cpp +++ b/examples/imapresource/tests/imapresourcetest.cpp | |||
@@ -100,7 +100,32 @@ private slots: | |||
100 | names << folder->getName(); | 100 | names << folder->getName(); |
101 | } | 101 | } |
102 | QVERIFY(names.contains("INBOX")); | 102 | QVERIFY(names.contains("INBOX")); |
103 | QVERIFY(names.contains("INBOX.test")); | 103 | QVERIFY(names.contains("test")); |
104 | }); | ||
105 | VERIFYEXEC(job); | ||
106 | } | ||
107 | |||
108 | void testListFolderHierarchy() | ||
109 | { | ||
110 | Sink::Query query; | ||
111 | query.resources << "org.kde.imap.instance1"; | ||
112 | query.request<Folder::Name>().request<Folder::Parent>(); | ||
113 | |||
114 | Imap::ImapServerProxy imap("localhost", 993); | ||
115 | VERIFYEXEC(imap.login("doe", "doe")); | ||
116 | VERIFYEXEC(imap.create("INBOX.test.sub")); | ||
117 | |||
118 | // Ensure all local data is processed | ||
119 | VERIFYEXEC(Store::synchronize(query)); | ||
120 | ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); | ||
121 | |||
122 | auto job = Store::fetchAll<Folder>(query).then<void, QList<Folder::Ptr>>([](const QList<Folder::Ptr> &folders) { | ||
123 | QCOMPARE(folders.size(), 3); | ||
124 | QHash<QString, Folder::Ptr> map; | ||
125 | for (const auto &folder : folders) { | ||
126 | map.insert(folder->getName(), folder); | ||
127 | } | ||
128 | QCOMPARE(map.value("sub")->getParent(), map.value("test")->identifier()); | ||
104 | }); | 129 | }); |
105 | VERIFYEXEC(job); | 130 | VERIFYEXEC(job); |
106 | } | 131 | } |
diff --git a/examples/imapresource/tests/imapserverproxytest.cpp b/examples/imapresource/tests/imapserverproxytest.cpp index d13a937..139597a 100644 --- a/examples/imapresource/tests/imapserverproxytest.cpp +++ b/examples/imapresource/tests/imapserverproxytest.cpp | |||
@@ -36,6 +36,8 @@ do {\ | |||
36 | return;\ | 36 | return;\ |
37 | } while (0) | 37 | } while (0) |
38 | 38 | ||
39 | using namespace Imap; | ||
40 | |||
39 | /** | 41 | /** |
40 | */ | 42 | */ |
41 | class ImapServerProxyTest : public QObject | 43 | class ImapServerProxyTest : public QObject |
@@ -77,7 +79,7 @@ private slots: | |||
77 | void testFetchFolders() | 79 | void testFetchFolders() |
78 | { | 80 | { |
79 | ImapServerProxy imap("localhost", 993); | 81 | ImapServerProxy imap("localhost", 993); |
80 | auto future = imap.fetchFolders([](const QStringList &){}); | 82 | auto future = imap.fetchFolders([](const QVector<Folder> &){}); |
81 | future.waitForFinished(); | 83 | future.waitForFinished(); |
82 | QVERIFY(!future.errorCode()); | 84 | QVERIFY(!future.errorCode()); |
83 | } | 85 | } |
@@ -85,7 +87,7 @@ private slots: | |||
85 | void testFetchFoldersFailure() | 87 | void testFetchFoldersFailure() |
86 | { | 88 | { |
87 | ImapServerProxy imap("foobar", 993); | 89 | ImapServerProxy imap("foobar", 993); |
88 | auto future = imap.fetchFolders([](const QStringList &){}); | 90 | auto future = imap.fetchFolders([](const QVector<Folder> &){}); |
89 | auto future2 = future; | 91 | auto future2 = future; |
90 | future2.waitForFinished(); | 92 | future2.waitForFinished(); |
91 | QVERIFY(future2.errorCode()); | 93 | QVERIFY(future2.errorCode()); |
diff --git a/examples/imapresource/tests/resetmailbox.sh b/examples/imapresource/tests/resetmailbox.sh index 966115a..fc78f60 100644 --- a/examples/imapresource/tests/resetmailbox.sh +++ b/examples/imapresource/tests/resetmailbox.sh | |||
@@ -1,9 +1,9 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | sudo echo "dm user.doe.test" | cyradm --auth PLAIN -u cyrus -w admin localhost | 3 | sudo echo "sam user.doe.* cyrus c" | cyradm --auth PLAIN -u cyrus -w admin localhost |
4 | sudo echo "dm user.doe.*" | cyradm --auth PLAIN -u cyrus -w admin localhost | ||
4 | sudo echo "cm user.doe.test" | cyradm --auth PLAIN -u cyrus -w admin localhost | 5 | sudo echo "cm user.doe.test" | cyradm --auth PLAIN -u cyrus -w admin localhost |
5 | sudo echo "sam user.doe cyrus c" | cyradm --auth PLAIN -u cyrus -w admin localhost | 6 | sudo echo "sam user.doe cyrus c" | cyradm --auth PLAIN -u cyrus -w admin localhost |
6 | sudo echo "sam user.doe.test cyrus c" | cyradm --auth PLAIN -u cyrus -w admin localhost | ||
7 | # sudo rm -R /var/spool/imap/d/user/doe/* | 7 | # sudo rm -R /var/spool/imap/d/user/doe/* |
8 | sudo cp /work/source/Sink/tests/data/maildir1/cur/1365777830.R28.localhost.localdomain\:2\,S /var/spool/imap/d/user/doe/test/1. | 8 | sudo cp /work/source/Sink/tests/data/maildir1/cur/1365777830.R28.localhost.localdomain\:2\,S /var/spool/imap/d/user/doe/test/1. |
9 | sudo chown cyrus:mail /var/spool/imap/d/user/doe/test/1. | 9 | sudo chown cyrus:mail /var/spool/imap/d/user/doe/test/1. |