From e3da13d1fe9ad623e05aec1977c813e7da37cedd Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 7 Jul 2016 11:46:45 +0200 Subject: Fail quickly if the backend is not available --- examples/imapresource/tests/imapmailsynctest.cpp | 8 ++++++++ examples/imapresource/tests/imapmailtest.cpp | 8 ++++++++ examples/imapresource/tests/imapserverproxytest.cpp | 4 ++++ 3 files changed, 20 insertions(+) (limited to 'examples/imapresource') diff --git a/examples/imapresource/tests/imapmailsynctest.cpp b/examples/imapresource/tests/imapmailsynctest.cpp index 968cde5..fcc659d 100644 --- a/examples/imapresource/tests/imapmailsynctest.cpp +++ b/examples/imapresource/tests/imapmailsynctest.cpp @@ -17,6 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include +#include #include #include "../imapresource.h" @@ -38,6 +39,13 @@ class ImapMailSyncTest : public Sink::MailSyncTest Q_OBJECT protected: + bool isBackendAvailable() Q_DECL_OVERRIDE + { + QTcpSocket socket; + socket.connectToHost("localhost", 993); + return socket.waitForConnected(200); + } + void resetTestEnvironment() Q_DECL_OVERRIDE { system("resetmailbox.sh"); diff --git a/examples/imapresource/tests/imapmailtest.cpp b/examples/imapresource/tests/imapmailtest.cpp index c94a731..e6f41f4 100644 --- a/examples/imapresource/tests/imapmailtest.cpp +++ b/examples/imapresource/tests/imapmailtest.cpp @@ -1,4 +1,5 @@ #include +#include #include @@ -18,6 +19,13 @@ class ImapMailTest : public Sink::MailTest Q_OBJECT protected: + bool isBackendAvailable() Q_DECL_OVERRIDE + { + QTcpSocket socket; + socket.connectToHost("localhost", 993); + return socket.waitForConnected(200); + } + void resetTestEnvironment() Q_DECL_OVERRIDE { system("resetmailbox.sh"); diff --git a/examples/imapresource/tests/imapserverproxytest.cpp b/examples/imapresource/tests/imapserverproxytest.cpp index e32298c..6819685 100644 --- a/examples/imapresource/tests/imapserverproxytest.cpp +++ b/examples/imapresource/tests/imapserverproxytest.cpp @@ -2,6 +2,7 @@ #include #include +#include #include "../imapserverproxy.h" @@ -22,6 +23,9 @@ class ImapServerProxyTest : public QObject private slots: void initTestCase() { + QTcpSocket socket; + socket.connectToHost("localhost", 993); + QVERIFY(socket.waitForConnected(200)); Sink::Log::setDebugOutputLevel(Sink::Log::Trace); system("resetmailbox.sh"); } -- cgit v1.2.3