diff --git a/lang/qt/tests/t-support.cpp b/lang/qt/tests/t-support.cpp index 7b16ccc3..854dd7bd 100644 --- a/lang/qt/tests/t-support.cpp +++ b/lang/qt/tests/t-support.cpp @@ -59,6 +59,12 @@ void QGpgMETest::cleanupTestCase() killAgent(); } +// static +bool QGpgMETest::doOnlineTests() +{ + return !qgetenv("DO_ONLINE_TESTS").isEmpty(); +} + bool QGpgMETest::copyKeyrings(const QString &src, const QString &dest) { bool is21dir = QFileInfo(src + QDir::separator() + QStringLiteral("pubring.kbx")).exists(); diff --git a/lang/qt/tests/t-support.h b/lang/qt/tests/t-support.h index 22ba473c..8435de5b 100644 --- a/lang/qt/tests/t-support.h +++ b/lang/qt/tests/t-support.h @@ -70,6 +70,8 @@ class QGpgMETest : public QObject { Q_OBJECT protected: + static bool doOnlineTests(); + bool copyKeyrings(const QString &from, const QString& to); public Q_SLOTS: diff --git a/lang/qt/tests/t-wkdlookup.cpp b/lang/qt/tests/t-wkdlookup.cpp index 13c70269..0fbe67a2 100644 --- a/lang/qt/tests/t-wkdlookup.cpp +++ b/lang/qt/tests/t-wkdlookup.cpp @@ -75,12 +75,14 @@ Q_SIGNALS: private Q_SLOTS: -#ifndef DO_ONLINE_TESTS void testWKDLookupAsync() { if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < requiredVersion) { QSKIP("dirmngr does not yet support WKD lookup"); } + if (!doOnlineTests()) { + QSKIP("Set DO_ONLINE_TESTS environment variable to run this test."); + } const QString email = QLatin1String{"wk@gnupg.org"}; WKDLookupResult result; @@ -106,6 +108,9 @@ private Q_SLOTS: if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < requiredVersion) { QSKIP("dirmngr does not yet support WKD lookup"); } + if (!doOnlineTests()) { + QSKIP("Set DO_ONLINE_TESTS environment variable to run this test."); + } const QString email = QLatin1String{"wk@gnupg.org"}; auto *job = openpgp()->wkdLookupJob(); @@ -123,6 +128,9 @@ private Q_SLOTS: if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < requiredVersion) { QSKIP("dirmngr does not yet support WKD lookup"); } + if (!doOnlineTests()) { + QSKIP("Set DO_ONLINE_TESTS environment variable to run this test."); + } const QString email = QLatin1String{"alfa@example.net"}; WKDLookupResult result; @@ -140,7 +148,6 @@ private Q_SLOTS: QCOMPARE(result.source(), ""); QVERIFY(result.keyData().isNull()); } -#endif }; QTEST_MAIN(WKDLookupTest)