summaryrefslogtreecommitdiffstats
path: root/examples/imapresource
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-09-20 10:52:30 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-09-20 10:52:30 +0200
commit160f3153cffb110f5b52e244485ccbc2c15b002c (patch)
tree5159a2f7dc3ee04d34998d383357eddeb76da0ea /examples/imapresource
parentcb21b7d053ab35f61e8316853f57ec1ce121e484 (diff)
downloadsink-160f3153cffb110f5b52e244485ccbc2c15b002c.tar.gz
sink-160f3153cffb110f5b52e244485ccbc2c15b002c.zip
Fixed tests with secretstore
Diffstat (limited to 'examples/imapresource')
-rw-r--r--examples/imapresource/imapresource.cpp9
-rw-r--r--examples/imapresource/tests/imapmailsynctest.cpp5
-rw-r--r--examples/imapresource/tests/imapmailtest.cpp3
3 files changed, 8 insertions, 9 deletions
diff --git a/examples/imapresource/imapresource.cpp b/examples/imapresource/imapresource.cpp
index 2aba6b0..b8a741b 100644
--- a/examples/imapresource/imapresource.cpp
+++ b/examples/imapresource/imapresource.cpp
@@ -841,7 +841,7 @@ protected:
841 auto messageByUid = QSharedPointer<QHash<qint64, Imap::Message>>::create(); 841 auto messageByUid = QSharedPointer<QHash<qint64, Imap::Message>>::create();
842 SinkTrace() << "Connecting to:" << mServer << mPort; 842 SinkTrace() << "Connecting to:" << mServer << mPort;
843 SinkTrace() << "as:" << mUser; 843 SinkTrace() << "as:" << mUser;
844 auto inspectionJob = imap->login(mUser, mPassword) 844 auto inspectionJob = imap->login(mUser, secret())
845 .then(imap->select(folderRemoteId)) 845 .then(imap->select(folderRemoteId))
846 .then([](Imap::SelectResult){}) 846 .then([](Imap::SelectResult){})
847 .then(imap->fetch(set, scope, [imap, messageByUid](const Imap::Message &message) { 847 .then(imap->fetch(set, scope, [imap, messageByUid](const Imap::Message &message) {
@@ -907,7 +907,7 @@ protected:
907 scope.mode = KIMAP2::FetchJob::FetchScope::Headers; 907 scope.mode = KIMAP2::FetchJob::FetchScope::Headers;
908 auto imap = QSharedPointer<ImapServerProxy>::create(mServer, mPort); 908 auto imap = QSharedPointer<ImapServerProxy>::create(mServer, mPort);
909 auto messageByUid = QSharedPointer<QHash<qint64, Imap::Message>>::create(); 909 auto messageByUid = QSharedPointer<QHash<qint64, Imap::Message>>::create();
910 return imap->login(mUser, mPassword) 910 return imap->login(mUser, secret())
911 .then(imap->select(remoteId)) 911 .then(imap->select(remoteId))
912 .then(imap->fetch(set, scope, [=](const Imap::Message message) { 912 .then(imap->fetch(set, scope, [=](const Imap::Message message) {
913 messageByUid->insert(message.uid, message); 913 messageByUid->insert(message.uid, message);
@@ -924,7 +924,7 @@ protected:
924 auto folderByName = QSharedPointer<QSet<QString>>::create(); 924 auto folderByName = QSharedPointer<QSet<QString>>::create();
925 925
926 auto imap = QSharedPointer<ImapServerProxy>::create(mServer, mPort); 926 auto imap = QSharedPointer<ImapServerProxy>::create(mServer, mPort);
927 auto inspectionJob = imap->login(mUser, mPassword) 927 auto inspectionJob = imap->login(mUser, secret())
928 .then(imap->fetchFolders([=](const Imap::Folder &f) { 928 .then(imap->fetchFolders([=](const Imap::Folder &f) {
929 *folderByPath << f.path(); 929 *folderByPath << f.path();
930 *folderByName << f.name(); 930 *folderByName << f.name();
@@ -949,7 +949,6 @@ public:
949 QString mServer; 949 QString mServer;
950 int mPort; 950 int mPort;
951 QString mUser; 951 QString mUser;
952 QString mPassword;
953}; 952};
954 953
955 954
@@ -981,8 +980,6 @@ ImapResource::ImapResource(const ResourceContext &resourceContext)
981 inspector->mServer = server; 980 inspector->mServer = server;
982 inspector->mPort = port; 981 inspector->mPort = port;
983 inspector->mUser = user; 982 inspector->mUser = user;
984 //TODO
985 // inspector->mPassword = password;
986 setupInspector(inspector); 983 setupInspector(inspector);
987 984
988 setupPreprocessors(ENTITY_TYPE_MAIL, QVector<Sink::Preprocessor*>() << new SpecialPurposeProcessor << new MailPropertyExtractor); 985 setupPreprocessors(ENTITY_TYPE_MAIL, QVector<Sink::Preprocessor*>() << new SpecialPurposeProcessor << new MailPropertyExtractor);
diff --git a/examples/imapresource/tests/imapmailsynctest.cpp b/examples/imapresource/tests/imapmailsynctest.cpp
index 7cdb103..f20a77e 100644
--- a/examples/imapresource/tests/imapmailsynctest.cpp
+++ b/examples/imapresource/tests/imapmailsynctest.cpp
@@ -25,6 +25,7 @@
25 25
26#include "common/test.h" 26#include "common/test.h"
27#include "common/domain/applicationdomaintype.h" 27#include "common/domain/applicationdomaintype.h"
28#include "common/secretstore.h"
28 29
29using namespace Sink; 30using namespace Sink;
30using namespace Sink::ApplicationDomain; 31using namespace Sink::ApplicationDomain;
@@ -57,7 +58,7 @@ protected:
57 resource.setProperty("server", "localhost"); 58 resource.setProperty("server", "localhost");
58 resource.setProperty("port", 993); 59 resource.setProperty("port", 993);
59 resource.setProperty("username", "doe"); 60 resource.setProperty("username", "doe");
60 resource.setProperty("password", "doe"); 61 Sink::SecretStore::instance().insert(resource.identifier(), "doe");
61 return resource; 62 return resource;
62 } 63 }
63 64
@@ -68,7 +69,7 @@ protected:
68 resource.setProperty("server", "111.111.1.1"); 69 resource.setProperty("server", "111.111.1.1");
69 resource.setProperty("port", 993); 70 resource.setProperty("port", 993);
70 resource.setProperty("username", "doe"); 71 resource.setProperty("username", "doe");
71 resource.setProperty("password", "doe"); 72 Sink::SecretStore::instance().insert(resource.identifier(), "doe");
72 return resource; 73 return resource;
73 } 74 }
74 75
diff --git a/examples/imapresource/tests/imapmailtest.cpp b/examples/imapresource/tests/imapmailtest.cpp
index e6f41f4..60ec1bf 100644
--- a/examples/imapresource/tests/imapmailtest.cpp
+++ b/examples/imapresource/tests/imapmailtest.cpp
@@ -5,6 +5,7 @@
5 5
6#include "common/test.h" 6#include "common/test.h"
7#include "common/domain/applicationdomaintype.h" 7#include "common/domain/applicationdomaintype.h"
8#include "common/secretstore.h"
8 9
9using namespace Sink; 10using namespace Sink;
10using namespace Sink::ApplicationDomain; 11using namespace Sink::ApplicationDomain;
@@ -37,7 +38,7 @@ protected:
37 resource.setProperty("server", "localhost"); 38 resource.setProperty("server", "localhost");
38 resource.setProperty("port", 993); 39 resource.setProperty("port", 993);
39 resource.setProperty("username", "doe"); 40 resource.setProperty("username", "doe");
40 resource.setProperty("password", "doe"); 41 Sink::SecretStore::instance().insert(resource.identifier(), "doe");
41 return resource; 42 return resource;
42 } 43 }
43}; 44};