diff options
Diffstat (limited to 'examples/imapresource/tests')
-rw-r--r-- | examples/imapresource/tests/CMakeLists.txt | 2 | ||||
-rw-r--r-- | examples/imapresource/tests/imapmailtest.cpp | 45 |
2 files changed, 47 insertions, 0 deletions
diff --git a/examples/imapresource/tests/CMakeLists.txt b/examples/imapresource/tests/CMakeLists.txt index 8482720..b10adcd 100644 --- a/examples/imapresource/tests/CMakeLists.txt +++ b/examples/imapresource/tests/CMakeLists.txt | |||
@@ -16,8 +16,10 @@ endmacro(auto_tests) | |||
16 | auto_tests ( | 16 | auto_tests ( |
17 | imapresourcetest | 17 | imapresourcetest |
18 | imapserverproxytest | 18 | imapserverproxytest |
19 | imapmailtest | ||
19 | ) | 20 | ) |
20 | target_link_libraries(imapresourcetest sink_resource_imap) | 21 | target_link_libraries(imapresourcetest sink_resource_imap) |
21 | target_link_libraries(imapserverproxytest sink_resource_imap) | 22 | target_link_libraries(imapserverproxytest sink_resource_imap) |
23 | target_link_libraries(imapmailtest sink_test sink_resource_imap) | ||
22 | 24 | ||
23 | install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resetmailbox.sh DESTINATION bin PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ) | 25 | install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resetmailbox.sh DESTINATION bin PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ) |
diff --git a/examples/imapresource/tests/imapmailtest.cpp b/examples/imapresource/tests/imapmailtest.cpp new file mode 100644 index 0000000..82324af --- /dev/null +++ b/examples/imapresource/tests/imapmailtest.cpp | |||
@@ -0,0 +1,45 @@ | |||
1 | #include <QtTest> | ||
2 | |||
3 | #include <tests/mailtest.h> | ||
4 | #include "../imapresource.h" | ||
5 | |||
6 | #include "common/test.h" | ||
7 | #include "common/domain/applicationdomaintype.h" | ||
8 | |||
9 | using namespace Sink; | ||
10 | using namespace Sink::ApplicationDomain; | ||
11 | |||
12 | /** | ||
13 | * Test of complete system using the imap resource. | ||
14 | * | ||
15 | * This test requires the imap resource installed. | ||
16 | */ | ||
17 | class ImapMailTest : public Sink::MailTest | ||
18 | { | ||
19 | Q_OBJECT | ||
20 | |||
21 | protected: | ||
22 | void resetTestEnvironment() Q_DECL_OVERRIDE | ||
23 | { | ||
24 | system("resetmailbox.sh"); | ||
25 | } | ||
26 | |||
27 | Sink::ApplicationDomain::SinkResource createResource() Q_DECL_OVERRIDE | ||
28 | { | ||
29 | auto resource = ApplicationDomain::ImapResource::create("account1"); | ||
30 | resource.setProperty("server", "localhost"); | ||
31 | resource.setProperty("port", 993); | ||
32 | resource.setProperty("user", "doe"); | ||
33 | resource.setProperty("password", "doe"); | ||
34 | return resource; | ||
35 | } | ||
36 | |||
37 | void removeResourceFromDisk(const QByteArray &identifier) Q_DECL_OVERRIDE | ||
38 | { | ||
39 | ::ImapResource::removeFromDisk(identifier); | ||
40 | } | ||
41 | }; | ||
42 | |||
43 | QTEST_MAIN(ImapMailTest) | ||
44 | |||
45 | #include "imapmailtest.moc" | ||