aboutsummaryrefslogtreecommitdiffstats
path: root/lang/qt/tests/t-remarks.cpp
diff options
context:
space:
mode:
authorIngo Klöcker <[email protected]>2022-01-13 11:40:35 +0000
committerIngo Klöcker <[email protected]>2022-01-13 11:40:35 +0000
commitd308910cdfb31accae7cf790a956eb2f3cc6ae71 (patch)
treedf337883072d4ea5c7e01ab04cab84449665be54 /lang/qt/tests/t-remarks.cpp
parentqt,tests: Add asyncDone signal to base class of all tests (diff)
downloadgpgme-d308910cdfb31accae7cf790a956eb2f3cc6ae71.tar.gz
gpgme-d308910cdfb31accae7cf790a956eb2f3cc6ae71.zip
qt,tests: Add helper to hook up the test passphrase provider
* lang/qt/tests/t-support.h, lang/qt/tests/t-support.cpp (class QGpgMETest): Add member function hookUpPassphraseProvider. Add member mPassphraseProvider. * lang/qt/tests/t-changeexpiryjob.cpp, lang/qt/tests/t-encrypt.cpp, lang/qt/tests/t-remarks.cpp, lang/qt/tests/t-tofuinfo.cpp, lang/qt/tests/t-trustsignatures.cpp, lang/qt/tests/t-various.cpp: Use new helper. -- GnuPG-bug-id: 5770
Diffstat (limited to 'lang/qt/tests/t-remarks.cpp')
-rw-r--r--lang/qt/tests/t-remarks.cpp65
1 files changed, 10 insertions, 55 deletions
diff --git a/lang/qt/tests/t-remarks.cpp b/lang/qt/tests/t-remarks.cpp
index bba14ce9..f9a901ab 100644
--- a/lang/qt/tests/t-remarks.cpp
+++ b/lang/qt/tests/t-remarks.cpp
@@ -74,12 +74,7 @@ public:
// Create the job
auto job = openpgp()->signKeyJob();
QVERIFY (job);
-
- // Hack in the passphrase provider
- auto jobCtx = Job::context(job);
- TestPassphraseProvider provider;
- jobCtx->setPassphraseProvider(&provider);
- jobCtx->setPinentryMode(Context::PinentryLoopback);
+ hookUpPassphraseProvider(job);
// Setup the job
job->setExportable(false);
@@ -130,12 +125,7 @@ private Q_SLOTS:
// Create the job
auto job = openpgp()->signKeyJob();
QVERIFY (job);
-
- // Hack in the passphrase provider
- auto jobCtx = Job::context(job);
- TestPassphraseProvider provider;
- jobCtx->setPassphraseProvider(&provider);
- jobCtx->setPinentryMode(Context::PinentryLoopback);
+ hookUpPassphraseProvider(job);
// Setup the job
job->setExportable(true);
@@ -167,11 +157,7 @@ private Q_SLOTS:
// Now replace the remark
auto job3 = openpgp()->signKeyJob();
QVERIFY (job3);
-
- // Hack in the passphrase provider
- auto jobCtx3 = Job::context(job3);
- jobCtx3->setPassphraseProvider(&provider);
- jobCtx3->setPinentryMode(Context::PinentryLoopback);
+ hookUpPassphraseProvider(job3);
// Setup the job
job3->setExportable(false);
@@ -226,12 +212,7 @@ private Q_SLOTS:
// Create the job
auto job = openpgp()->signKeyJob();
QVERIFY (job);
-
- // Hack in the passphrase provider
- auto jobCtx = Job::context(job);
- TestPassphraseProvider provider;
- jobCtx->setPassphraseProvider(&provider);
- jobCtx->setPinentryMode(Context::PinentryLoopback);
+ hookUpPassphraseProvider(job);
// Setup the first job
job->setExportable(false);
@@ -254,11 +235,7 @@ private Q_SLOTS:
// Now another remark from zulu
auto job3 = openpgp()->signKeyJob();
QVERIFY (job3);
-
- // Hack in the passphrase provider
- auto jobCtx3 = Job::context(job3);
- jobCtx3->setPassphraseProvider(&provider);
- jobCtx3->setPinentryMode(Context::PinentryLoopback);
+ hookUpPassphraseProvider(job3);
// Setup the job
job3->setExportable(false);
@@ -312,12 +289,7 @@ private Q_SLOTS:
// Create the job
auto job = openpgp()->signKeyJob();
QVERIFY (job);
-
- // Hack in the passphrase provider
- auto jobCtx = Job::context(job);
- TestPassphraseProvider provider;
- jobCtx->setPassphraseProvider(&provider);
- jobCtx->setPinentryMode(Context::PinentryLoopback);
+ hookUpPassphraseProvider(job);
// Setup the job
job->setExportable(false);
@@ -349,11 +321,7 @@ private Q_SLOTS:
// Now replace the remark
auto job3 = openpgp()->signKeyJob();
QVERIFY (job3);
-
- // Hack in the passphrase provider
- auto jobCtx3 = Job::context(job3);
- jobCtx3->setPassphraseProvider(&provider);
- jobCtx3->setPinentryMode(Context::PinentryLoopback);
+ hookUpPassphraseProvider(job3);
// Setup the job
job3->setExportable(false);
@@ -402,12 +370,7 @@ private Q_SLOTS:
// Create the job
auto job = openpgp()->signKeyJob();
QVERIFY (job);
-
- // Hack in the passphrase provider
- auto jobCtx = Job::context(job);
- TestPassphraseProvider provider;
- jobCtx->setPassphraseProvider(&provider);
- jobCtx->setPinentryMode(Context::PinentryLoopback);
+ hookUpPassphraseProvider(job);
// Setup the job
job->setExportable(false);
@@ -438,11 +401,7 @@ private Q_SLOTS:
// Try to replace it without dupeOK
auto job2 = openpgp()->signKeyJob();
QVERIFY (job2);
-
- // Hack in the passphrase provider
- auto jobCtx2 = Job::context(job2);
- jobCtx2->setPassphraseProvider(&provider);
- jobCtx2->setPinentryMode(Context::PinentryLoopback);
+ hookUpPassphraseProvider(job2);
// Setup the job
job2->setExportable(false);
@@ -463,11 +422,7 @@ private Q_SLOTS:
// Now replace the remark
auto job3 = openpgp()->signKeyJob();
QVERIFY (job3);
-
- // Hack in the passphrase provider
- auto jobCtx3 = Job::context(job3);
- jobCtx3->setPassphraseProvider(&provider);
- jobCtx3->setPinentryMode(Context::PinentryLoopback);
+ hookUpPassphraseProvider(job3);
// Setup the job
job3->setExportable(false);