summaryrefslogtreecommitdiffstats
path: root/framework/domain/actions/tests/sinkactiontest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'framework/domain/actions/tests/sinkactiontest.cpp')
-rw-r--r--framework/domain/actions/tests/sinkactiontest.cpp58
1 files changed, 0 insertions, 58 deletions
diff --git a/framework/domain/actions/tests/sinkactiontest.cpp b/framework/domain/actions/tests/sinkactiontest.cpp
deleted file mode 100644
index 79375503..00000000
--- a/framework/domain/actions/tests/sinkactiontest.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
1#include <QTest>
2#include <QDebug>
3#include <QSignalSpy>
4#include <sink/test.h>
5#include <sink/store.h>
6#include <sink/log.h>
7#include <KMime/Message>
8
9#include <actions/action.h>
10#include <actions/context.h>
11
12using namespace Sink;
13
14class SinkActionTest : public QObject
15{
16 Q_OBJECT
17private slots:
18
19 void initTestCase()
20 {
21 Sink::Test::initTest();
22 Sink::Log::setDebugOutputLevel(Sink::Log::Trace);
23 }
24
25 void testSaveAsDraftFail()
26 {
27 Kube::Context context;
28 auto future = Kube::Action("org.kde.kube.actions.save-as-draft", context).executeWithResult();
29
30 QTRY_VERIFY(future.isDone());
31 //because of empty context
32 QVERIFY(future.error());
33 }
34
35 void testSaveAsDraftNew()
36 {
37 auto message = KMime::Message::Ptr::create();
38 message->subject(true)->fromUnicodeString(QString::fromLatin1("Foobar"), "utf8");
39 message->assemble();
40
41 auto &&account = Test::TestAccount::registerAccount();
42
43 Kube::Context context;
44 context.setProperty("message", QVariant::fromValue(message));
45 context.setProperty("accountId", QVariant::fromValue(account.identifier));
46 auto future = Kube::Action("org.kde.kube.actions.save-as-draft", context).executeWithResult();
47
48 QTRY_VERIFY(future.isDone());
49 QVERIFY(!future.error());
50 auto mails = account.entities<Sink::ApplicationDomain::Mail>();
51 QCOMPARE(mails.size(), 1);
52 auto mail = mails.first();
53 QVERIFY(mail->getProperty("draft").toBool());
54 }
55};
56
57QTEST_GUILESS_MAIN(SinkActionTest)
58#include "sinkactiontest.moc"