From 3a43d9dc67970db323c3e49eb964d52c4eb3ac6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20Kl=C3=B6cker?= Date: Tue, 14 Dec 2021 11:04:03 +0100 Subject: [PATCH] qt,tests: Skip WKD lookup tests by default * lang/qt/tests/t-support.cpp, lang/qt/tests/t-support.h (class QGpgMETest): Add member function doOnlineTests. * lang/qt/tests/t-wkdlookup.cpp (testWKDLookupAsync, testWKDLookupSync, testLookupWithNoResultAsync): Skip tests if online tests are not enabled. -- GnuPG-bug-id: 5728 --- lang/qt/tests/t-support.cpp | 6 ++++++ lang/qt/tests/t-support.h | 2 ++ lang/qt/tests/t-wkdlookup.cpp | 11 +++++++++-- 3 files changed, 17 insertions(+), 2 deletions(-) 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)