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
This commit is contained in:
parent
a54402fc2d
commit
d308910cdf
@ -76,12 +76,7 @@ private Q_SLOTS:
|
|||||||
// Create the job
|
// Create the job
|
||||||
auto job = std::unique_ptr<ChangeExpiryJob>{openpgp()->changeExpiryJob()};
|
auto job = std::unique_ptr<ChangeExpiryJob>{openpgp()->changeExpiryJob()};
|
||||||
QVERIFY(job);
|
QVERIFY(job);
|
||||||
|
hookUpPassphraseProvider(job.get());
|
||||||
// Hack in the passphrase provider
|
|
||||||
auto jobCtx = Job::context(job.get());
|
|
||||||
TestPassphraseProvider provider;
|
|
||||||
jobCtx->setPassphraseProvider(&provider);
|
|
||||||
jobCtx->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
|
|
||||||
// Use defaults of job
|
// Use defaults of job
|
||||||
|
|
||||||
@ -144,12 +139,7 @@ private Q_SLOTS:
|
|||||||
// Create the job
|
// Create the job
|
||||||
auto job = std::unique_ptr<ChangeExpiryJob>{openpgp()->changeExpiryJob()};
|
auto job = std::unique_ptr<ChangeExpiryJob>{openpgp()->changeExpiryJob()};
|
||||||
QVERIFY(job);
|
QVERIFY(job);
|
||||||
|
hookUpPassphraseProvider(job.get());
|
||||||
// Hack in the passphrase provider
|
|
||||||
auto jobCtx = Job::context(job.get());
|
|
||||||
TestPassphraseProvider provider;
|
|
||||||
jobCtx->setPassphraseProvider(&provider);
|
|
||||||
jobCtx->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
|
|
||||||
// Use defaults of job
|
// Use defaults of job
|
||||||
|
|
||||||
@ -212,12 +202,7 @@ private Q_SLOTS:
|
|||||||
// Create the job
|
// Create the job
|
||||||
auto job = std::unique_ptr<ChangeExpiryJob>{openpgp()->changeExpiryJob()};
|
auto job = std::unique_ptr<ChangeExpiryJob>{openpgp()->changeExpiryJob()};
|
||||||
QVERIFY(job);
|
QVERIFY(job);
|
||||||
|
hookUpPassphraseProvider(job.get());
|
||||||
// Hack in the passphrase provider
|
|
||||||
auto jobCtx = Job::context(job.get());
|
|
||||||
TestPassphraseProvider provider;
|
|
||||||
jobCtx->setPassphraseProvider(&provider);
|
|
||||||
jobCtx->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
|
|
||||||
// Set up the job
|
// Set up the job
|
||||||
job->setOptions(ChangeExpiryJob::UpdatePrimaryKey);
|
job->setOptions(ChangeExpiryJob::UpdatePrimaryKey);
|
||||||
@ -280,12 +265,7 @@ private Q_SLOTS:
|
|||||||
// Create the job
|
// Create the job
|
||||||
auto job = std::unique_ptr<ChangeExpiryJob>{openpgp()->changeExpiryJob()};
|
auto job = std::unique_ptr<ChangeExpiryJob>{openpgp()->changeExpiryJob()};
|
||||||
QVERIFY(job);
|
QVERIFY(job);
|
||||||
|
hookUpPassphraseProvider(job.get());
|
||||||
// Hack in the passphrase provider
|
|
||||||
auto jobCtx = Job::context(job.get());
|
|
||||||
TestPassphraseProvider provider;
|
|
||||||
jobCtx->setPassphraseProvider(&provider);
|
|
||||||
jobCtx->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
|
|
||||||
// Set up the job
|
// Set up the job
|
||||||
job->setOptions(ChangeExpiryJob::UpdatePrimaryKey);
|
job->setOptions(ChangeExpiryJob::UpdatePrimaryKey);
|
||||||
@ -353,12 +333,7 @@ private Q_SLOTS:
|
|||||||
// Create the job
|
// Create the job
|
||||||
auto job = std::unique_ptr<ChangeExpiryJob>{openpgp()->changeExpiryJob()};
|
auto job = std::unique_ptr<ChangeExpiryJob>{openpgp()->changeExpiryJob()};
|
||||||
QVERIFY(job);
|
QVERIFY(job);
|
||||||
|
hookUpPassphraseProvider(job.get());
|
||||||
// Hack in the passphrase provider
|
|
||||||
auto jobCtx = Job::context(job.get());
|
|
||||||
TestPassphraseProvider provider;
|
|
||||||
jobCtx->setPassphraseProvider(&provider);
|
|
||||||
jobCtx->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
|
|
||||||
// Set up the job
|
// Set up the job
|
||||||
job->setOptions(ChangeExpiryJob::UpdatePrimaryKey | ChangeExpiryJob::UpdateAllSubkeys);
|
job->setOptions(ChangeExpiryJob::UpdatePrimaryKey | ChangeExpiryJob::UpdateAllSubkeys);
|
||||||
|
@ -89,10 +89,7 @@ private Q_SLOTS:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto decJob = openpgp()->decryptJob();
|
auto decJob = openpgp()->decryptJob();
|
||||||
auto ctx = Job::context(decJob);
|
hookUpPassphraseProvider(decJob);
|
||||||
TestPassphraseProvider provider;
|
|
||||||
ctx->setPassphraseProvider(&provider);
|
|
||||||
ctx->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
QByteArray plainText;
|
QByteArray plainText;
|
||||||
auto decResult = decJob->exec(cipherText, plainText);
|
auto decResult = decJob->exec(cipherText, plainText);
|
||||||
QVERIFY(!decResult.error());
|
QVERIFY(!decResult.error());
|
||||||
@ -160,10 +157,8 @@ private Q_SLOTS:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto job = openpgp()->encryptJob();
|
auto job = openpgp()->encryptJob();
|
||||||
|
hookUpPassphraseProvider(job);
|
||||||
auto ctx = Job::context(job);
|
auto ctx = Job::context(job);
|
||||||
TestPassphraseProvider provider;
|
|
||||||
ctx->setPassphraseProvider(&provider);
|
|
||||||
ctx->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
ctx->setArmor(true);
|
ctx->setArmor(true);
|
||||||
ctx->setTextMode(true);
|
ctx->setTextMode(true);
|
||||||
QByteArray cipherText;
|
QByteArray cipherText;
|
||||||
@ -176,9 +171,7 @@ private Q_SLOTS:
|
|||||||
killAgent(mDir.path());
|
killAgent(mDir.path());
|
||||||
|
|
||||||
auto decJob = openpgp()->decryptJob();
|
auto decJob = openpgp()->decryptJob();
|
||||||
auto ctx2 = Job::context(decJob);
|
hookUpPassphraseProvider(decJob);
|
||||||
ctx2->setPassphraseProvider(&provider);
|
|
||||||
ctx2->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
QByteArray plainText;
|
QByteArray plainText;
|
||||||
auto decResult = decJob->exec(cipherText, plainText);
|
auto decResult = decJob->exec(cipherText, plainText);
|
||||||
QVERIFY(!result.error());
|
QVERIFY(!result.error());
|
||||||
@ -201,13 +194,9 @@ private Q_SLOTS:
|
|||||||
delete listjob;
|
delete listjob;
|
||||||
|
|
||||||
auto job = openpgp()->signEncryptJob(/*ASCII Armor */true, /* Textmode */ true);
|
auto job = openpgp()->signEncryptJob(/*ASCII Armor */true, /* Textmode */ true);
|
||||||
|
|
||||||
auto encSignCtx = Job::context(job);
|
|
||||||
TestPassphraseProvider provider1;
|
|
||||||
encSignCtx->setPassphraseProvider(&provider1);
|
|
||||||
encSignCtx->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
|
|
||||||
QVERIFY(job);
|
QVERIFY(job);
|
||||||
|
hookUpPassphraseProvider(job);
|
||||||
|
|
||||||
QByteArray cipherText;
|
QByteArray cipherText;
|
||||||
auto result = job->exec(keys, keys, QStringLiteral("Hello World").toUtf8(), Context::AlwaysTrust, cipherText);
|
auto result = job->exec(keys, keys, QStringLiteral("Hello World").toUtf8(), Context::AlwaysTrust, cipherText);
|
||||||
delete job;
|
delete job;
|
||||||
@ -222,10 +211,8 @@ private Q_SLOTS:
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto decJob = openpgp()->decryptJob();
|
auto decJob = openpgp()->decryptJob();
|
||||||
|
hookUpPassphraseProvider(decJob);
|
||||||
auto ctx = Job::context(decJob);
|
auto ctx = Job::context(decJob);
|
||||||
TestPassphraseProvider provider;
|
|
||||||
ctx->setPassphraseProvider(&provider);
|
|
||||||
ctx->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
ctx->setDecryptionFlags(Context::DecryptUnwrap);
|
ctx->setDecryptionFlags(Context::DecryptUnwrap);
|
||||||
|
|
||||||
QByteArray plainText;
|
QByteArray plainText;
|
||||||
@ -266,9 +253,8 @@ private:
|
|||||||
delete listjob;
|
delete listjob;
|
||||||
|
|
||||||
auto job = openpgp()->encryptJob();
|
auto job = openpgp()->encryptJob();
|
||||||
|
hookUpPassphraseProvider(job);
|
||||||
auto ctx = Job::context(job);
|
auto ctx = Job::context(job);
|
||||||
ctx->setPassphraseProvider(new TestPassphraseProvider);
|
|
||||||
ctx->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
ctx->setArmor(true);
|
ctx->setArmor(true);
|
||||||
ctx->setTextMode(true);
|
ctx->setTextMode(true);
|
||||||
QByteArray cipherText;
|
QByteArray cipherText;
|
||||||
@ -294,9 +280,8 @@ private:
|
|||||||
agentConf.close();
|
agentConf.close();
|
||||||
|
|
||||||
auto decJob = openpgp()->decryptJob();
|
auto decJob = openpgp()->decryptJob();
|
||||||
|
hookUpPassphraseProvider(decJob);
|
||||||
auto ctx2 = Job::context(decJob);
|
auto ctx2 = Job::context(decJob);
|
||||||
ctx2->setPassphraseProvider(new TestPassphraseProvider);
|
|
||||||
ctx2->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
ctx2->setTextMode(true);
|
ctx2->setTextMode(true);
|
||||||
QByteArray plainText;
|
QByteArray plainText;
|
||||||
auto decResult = decJob->exec(cipherText, plainText);
|
auto decResult = decJob->exec(cipherText, plainText);
|
||||||
|
@ -74,12 +74,7 @@ public:
|
|||||||
// Create the job
|
// Create the job
|
||||||
auto job = openpgp()->signKeyJob();
|
auto job = openpgp()->signKeyJob();
|
||||||
QVERIFY (job);
|
QVERIFY (job);
|
||||||
|
hookUpPassphraseProvider(job);
|
||||||
// Hack in the passphrase provider
|
|
||||||
auto jobCtx = Job::context(job);
|
|
||||||
TestPassphraseProvider provider;
|
|
||||||
jobCtx->setPassphraseProvider(&provider);
|
|
||||||
jobCtx->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
|
|
||||||
// Setup the job
|
// Setup the job
|
||||||
job->setExportable(false);
|
job->setExportable(false);
|
||||||
@ -130,12 +125,7 @@ private Q_SLOTS:
|
|||||||
// Create the job
|
// Create the job
|
||||||
auto job = openpgp()->signKeyJob();
|
auto job = openpgp()->signKeyJob();
|
||||||
QVERIFY (job);
|
QVERIFY (job);
|
||||||
|
hookUpPassphraseProvider(job);
|
||||||
// Hack in the passphrase provider
|
|
||||||
auto jobCtx = Job::context(job);
|
|
||||||
TestPassphraseProvider provider;
|
|
||||||
jobCtx->setPassphraseProvider(&provider);
|
|
||||||
jobCtx->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
|
|
||||||
// Setup the job
|
// Setup the job
|
||||||
job->setExportable(true);
|
job->setExportable(true);
|
||||||
@ -167,11 +157,7 @@ private Q_SLOTS:
|
|||||||
// Now replace the remark
|
// Now replace the remark
|
||||||
auto job3 = openpgp()->signKeyJob();
|
auto job3 = openpgp()->signKeyJob();
|
||||||
QVERIFY (job3);
|
QVERIFY (job3);
|
||||||
|
hookUpPassphraseProvider(job3);
|
||||||
// Hack in the passphrase provider
|
|
||||||
auto jobCtx3 = Job::context(job3);
|
|
||||||
jobCtx3->setPassphraseProvider(&provider);
|
|
||||||
jobCtx3->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
|
|
||||||
// Setup the job
|
// Setup the job
|
||||||
job3->setExportable(false);
|
job3->setExportable(false);
|
||||||
@ -226,12 +212,7 @@ private Q_SLOTS:
|
|||||||
// Create the job
|
// Create the job
|
||||||
auto job = openpgp()->signKeyJob();
|
auto job = openpgp()->signKeyJob();
|
||||||
QVERIFY (job);
|
QVERIFY (job);
|
||||||
|
hookUpPassphraseProvider(job);
|
||||||
// Hack in the passphrase provider
|
|
||||||
auto jobCtx = Job::context(job);
|
|
||||||
TestPassphraseProvider provider;
|
|
||||||
jobCtx->setPassphraseProvider(&provider);
|
|
||||||
jobCtx->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
|
|
||||||
// Setup the first job
|
// Setup the first job
|
||||||
job->setExportable(false);
|
job->setExportable(false);
|
||||||
@ -254,11 +235,7 @@ private Q_SLOTS:
|
|||||||
// Now another remark from zulu
|
// Now another remark from zulu
|
||||||
auto job3 = openpgp()->signKeyJob();
|
auto job3 = openpgp()->signKeyJob();
|
||||||
QVERIFY (job3);
|
QVERIFY (job3);
|
||||||
|
hookUpPassphraseProvider(job3);
|
||||||
// Hack in the passphrase provider
|
|
||||||
auto jobCtx3 = Job::context(job3);
|
|
||||||
jobCtx3->setPassphraseProvider(&provider);
|
|
||||||
jobCtx3->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
|
|
||||||
// Setup the job
|
// Setup the job
|
||||||
job3->setExportable(false);
|
job3->setExportable(false);
|
||||||
@ -312,12 +289,7 @@ private Q_SLOTS:
|
|||||||
// Create the job
|
// Create the job
|
||||||
auto job = openpgp()->signKeyJob();
|
auto job = openpgp()->signKeyJob();
|
||||||
QVERIFY (job);
|
QVERIFY (job);
|
||||||
|
hookUpPassphraseProvider(job);
|
||||||
// Hack in the passphrase provider
|
|
||||||
auto jobCtx = Job::context(job);
|
|
||||||
TestPassphraseProvider provider;
|
|
||||||
jobCtx->setPassphraseProvider(&provider);
|
|
||||||
jobCtx->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
|
|
||||||
// Setup the job
|
// Setup the job
|
||||||
job->setExportable(false);
|
job->setExportable(false);
|
||||||
@ -349,11 +321,7 @@ private Q_SLOTS:
|
|||||||
// Now replace the remark
|
// Now replace the remark
|
||||||
auto job3 = openpgp()->signKeyJob();
|
auto job3 = openpgp()->signKeyJob();
|
||||||
QVERIFY (job3);
|
QVERIFY (job3);
|
||||||
|
hookUpPassphraseProvider(job3);
|
||||||
// Hack in the passphrase provider
|
|
||||||
auto jobCtx3 = Job::context(job3);
|
|
||||||
jobCtx3->setPassphraseProvider(&provider);
|
|
||||||
jobCtx3->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
|
|
||||||
// Setup the job
|
// Setup the job
|
||||||
job3->setExportable(false);
|
job3->setExportable(false);
|
||||||
@ -402,12 +370,7 @@ private Q_SLOTS:
|
|||||||
// Create the job
|
// Create the job
|
||||||
auto job = openpgp()->signKeyJob();
|
auto job = openpgp()->signKeyJob();
|
||||||
QVERIFY (job);
|
QVERIFY (job);
|
||||||
|
hookUpPassphraseProvider(job);
|
||||||
// Hack in the passphrase provider
|
|
||||||
auto jobCtx = Job::context(job);
|
|
||||||
TestPassphraseProvider provider;
|
|
||||||
jobCtx->setPassphraseProvider(&provider);
|
|
||||||
jobCtx->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
|
|
||||||
// Setup the job
|
// Setup the job
|
||||||
job->setExportable(false);
|
job->setExportable(false);
|
||||||
@ -438,11 +401,7 @@ private Q_SLOTS:
|
|||||||
// Try to replace it without dupeOK
|
// Try to replace it without dupeOK
|
||||||
auto job2 = openpgp()->signKeyJob();
|
auto job2 = openpgp()->signKeyJob();
|
||||||
QVERIFY (job2);
|
QVERIFY (job2);
|
||||||
|
hookUpPassphraseProvider(job2);
|
||||||
// Hack in the passphrase provider
|
|
||||||
auto jobCtx2 = Job::context(job2);
|
|
||||||
jobCtx2->setPassphraseProvider(&provider);
|
|
||||||
jobCtx2->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
|
|
||||||
// Setup the job
|
// Setup the job
|
||||||
job2->setExportable(false);
|
job2->setExportable(false);
|
||||||
@ -463,11 +422,7 @@ private Q_SLOTS:
|
|||||||
// Now replace the remark
|
// Now replace the remark
|
||||||
auto job3 = openpgp()->signKeyJob();
|
auto job3 = openpgp()->signKeyJob();
|
||||||
QVERIFY (job3);
|
QVERIFY (job3);
|
||||||
|
hookUpPassphraseProvider(job3);
|
||||||
// Hack in the passphrase provider
|
|
||||||
auto jobCtx3 = Job::context(job3);
|
|
||||||
jobCtx3->setPassphraseProvider(&provider);
|
|
||||||
jobCtx3->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
|
|
||||||
// Setup the job
|
// Setup the job
|
||||||
job3->setExportable(false);
|
job3->setExportable(false);
|
||||||
|
@ -35,7 +35,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "t-support.h"
|
#include "t-support.h"
|
||||||
#include "context.h"
|
|
||||||
|
#include "job.h"
|
||||||
|
|
||||||
#include <QTest>
|
#include <QTest>
|
||||||
|
|
||||||
@ -44,8 +45,12 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
|
#include "context.h"
|
||||||
#include "engineinfo.h"
|
#include "engineinfo.h"
|
||||||
|
|
||||||
|
using namespace GpgME;
|
||||||
|
using namespace QGpgME;
|
||||||
|
|
||||||
void QGpgMETest::initTestCase()
|
void QGpgMETest::initTestCase()
|
||||||
{
|
{
|
||||||
GpgME::initializeLibrary();
|
GpgME::initializeLibrary();
|
||||||
@ -92,6 +97,17 @@ bool QGpgMETest::copyKeyrings(const QString &src, const QString &dest)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QGpgMETest::hookUpPassphraseProvider(GpgME::Context *context)
|
||||||
|
{
|
||||||
|
context->setPassphraseProvider(&mPassphraseProvider);
|
||||||
|
context->setPinentryMode(Context::PinentryLoopback);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QGpgMETest::hookUpPassphraseProvider(QGpgME::Job *job)
|
||||||
|
{
|
||||||
|
hookUpPassphraseProvider(Job::context(job));
|
||||||
|
}
|
||||||
|
|
||||||
void killAgent(const QString& dir)
|
void killAgent(const QString& dir)
|
||||||
{
|
{
|
||||||
QProcess proc;
|
QProcess proc;
|
||||||
|
@ -38,6 +38,16 @@
|
|||||||
|
|
||||||
#include <gpg-error.h>
|
#include <gpg-error.h>
|
||||||
|
|
||||||
|
namespace GpgME
|
||||||
|
{
|
||||||
|
class Context;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace QGpgME
|
||||||
|
{
|
||||||
|
class Job;
|
||||||
|
}
|
||||||
|
|
||||||
namespace QTest
|
namespace QTest
|
||||||
{
|
{
|
||||||
template <>
|
template <>
|
||||||
@ -78,9 +88,15 @@ protected:
|
|||||||
|
|
||||||
bool copyKeyrings(const QString &from, const QString& to);
|
bool copyKeyrings(const QString &from, const QString& to);
|
||||||
|
|
||||||
|
void hookUpPassphraseProvider(GpgME::Context *context);
|
||||||
|
void hookUpPassphraseProvider(QGpgME::Job *job);
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void initTestCase();
|
void initTestCase();
|
||||||
void cleanupTestCase();
|
void cleanupTestCase();
|
||||||
|
|
||||||
|
private:
|
||||||
|
GpgME::TestPassphraseProvider mPassphraseProvider;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Timeout, in milliseconds, for use with QSignalSpy to wait on
|
/* Timeout, in milliseconds, for use with QSignalSpy to wait on
|
||||||
|
@ -153,10 +153,7 @@ private:
|
|||||||
void signAndVerify(const QString &what, const GpgME::Key &key, int expected)
|
void signAndVerify(const QString &what, const GpgME::Key &key, int expected)
|
||||||
{
|
{
|
||||||
auto job = openpgp()->signJob();
|
auto job = openpgp()->signJob();
|
||||||
auto ctx = Job::context(job);
|
hookUpPassphraseProvider(job);
|
||||||
TestPassphraseProvider provider;
|
|
||||||
ctx->setPassphraseProvider(&provider);
|
|
||||||
ctx->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
|
|
||||||
std::vector<Key> keys;
|
std::vector<Key> keys;
|
||||||
keys.push_back(key);
|
keys.push_back(key);
|
||||||
|
@ -80,12 +80,7 @@ private Q_SLOTS:
|
|||||||
// Create the job
|
// Create the job
|
||||||
auto job = std::unique_ptr<SignKeyJob>{openpgp()->signKeyJob()};
|
auto job = std::unique_ptr<SignKeyJob>{openpgp()->signKeyJob()};
|
||||||
QVERIFY(job);
|
QVERIFY(job);
|
||||||
|
hookUpPassphraseProvider(job.get());
|
||||||
// Hack in the passphrase provider
|
|
||||||
auto jobCtx = Job::context(job.get());
|
|
||||||
TestPassphraseProvider provider;
|
|
||||||
jobCtx->setPassphraseProvider(&provider);
|
|
||||||
jobCtx->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
|
|
||||||
// Setup the job
|
// Setup the job
|
||||||
job->setExportable(true);
|
job->setExportable(true);
|
||||||
@ -128,12 +123,7 @@ private Q_SLOTS:
|
|||||||
// Create the job
|
// Create the job
|
||||||
auto job = std::unique_ptr<SignKeyJob>{openpgp()->signKeyJob()};
|
auto job = std::unique_ptr<SignKeyJob>{openpgp()->signKeyJob()};
|
||||||
QVERIFY(job);
|
QVERIFY(job);
|
||||||
|
hookUpPassphraseProvider(job.get());
|
||||||
// Hack in the passphrase provider
|
|
||||||
auto jobCtx = Job::context(job.get());
|
|
||||||
TestPassphraseProvider provider;
|
|
||||||
jobCtx->setPassphraseProvider(&provider);
|
|
||||||
jobCtx->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
|
|
||||||
// Setup the job
|
// Setup the job
|
||||||
job->setExportable(true);
|
job->setExportable(true);
|
||||||
@ -201,12 +191,7 @@ private Q_SLOTS:
|
|||||||
// Create the job
|
// Create the job
|
||||||
auto job = openpgp()->signKeyJob();//std::unique_ptr<SignKeyJob>{openpgp()->signKeyJob()};
|
auto job = openpgp()->signKeyJob();//std::unique_ptr<SignKeyJob>{openpgp()->signKeyJob()};
|
||||||
QVERIFY(job);
|
QVERIFY(job);
|
||||||
|
hookUpPassphraseProvider(job);
|
||||||
// Hack in the passphrase provider
|
|
||||||
auto jobCtx = Job::context(job);
|
|
||||||
TestPassphraseProvider provider;
|
|
||||||
jobCtx->setPassphraseProvider(&provider);
|
|
||||||
jobCtx->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
|
|
||||||
// Setup the job
|
// Setup the job
|
||||||
job->setExportable(true);
|
job->setExportable(true);
|
||||||
@ -249,12 +234,7 @@ private Q_SLOTS:
|
|||||||
// Create the job
|
// Create the job
|
||||||
auto job = openpgp()->signKeyJob();//std::unique_ptr<SignKeyJob>{openpgp()->signKeyJob()};
|
auto job = openpgp()->signKeyJob();//std::unique_ptr<SignKeyJob>{openpgp()->signKeyJob()};
|
||||||
QVERIFY(job);
|
QVERIFY(job);
|
||||||
|
hookUpPassphraseProvider(job);
|
||||||
// Hack in the passphrase provider
|
|
||||||
auto jobCtx = Job::context(job);
|
|
||||||
TestPassphraseProvider provider;
|
|
||||||
jobCtx->setPassphraseProvider(&provider);
|
|
||||||
jobCtx->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
|
|
||||||
// Setup the job
|
// Setup the job
|
||||||
job->setExportable(true);
|
job->setExportable(true);
|
||||||
@ -322,12 +302,7 @@ private Q_SLOTS:
|
|||||||
// Create the job
|
// Create the job
|
||||||
auto job = openpgp()->signKeyJob();//std::unique_ptr<SignKeyJob>{openpgp()->signKeyJob()};
|
auto job = openpgp()->signKeyJob();//std::unique_ptr<SignKeyJob>{openpgp()->signKeyJob()};
|
||||||
QVERIFY(job);
|
QVERIFY(job);
|
||||||
|
hookUpPassphraseProvider(job);
|
||||||
// Hack in the passphrase provider
|
|
||||||
auto jobCtx = Job::context(job);
|
|
||||||
TestPassphraseProvider provider;
|
|
||||||
jobCtx->setPassphraseProvider(&provider);
|
|
||||||
jobCtx->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
|
|
||||||
// Setup the job
|
// Setup the job
|
||||||
job->setExportable(true);
|
job->setExportable(true);
|
||||||
@ -371,12 +346,7 @@ private Q_SLOTS:
|
|||||||
// Create the job
|
// Create the job
|
||||||
auto job = openpgp()->signKeyJob();//std::unique_ptr<SignKeyJob>{openpgp()->signKeyJob()};
|
auto job = openpgp()->signKeyJob();//std::unique_ptr<SignKeyJob>{openpgp()->signKeyJob()};
|
||||||
QVERIFY(job);
|
QVERIFY(job);
|
||||||
|
hookUpPassphraseProvider(job);
|
||||||
// Hack in the passphrase provider
|
|
||||||
auto jobCtx = Job::context(job);
|
|
||||||
TestPassphraseProvider provider;
|
|
||||||
jobCtx->setPassphraseProvider(&provider);
|
|
||||||
jobCtx->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
|
|
||||||
// Setup the job
|
// Setup the job
|
||||||
job->setExportable(true);
|
job->setExportable(true);
|
||||||
@ -444,12 +414,7 @@ private Q_SLOTS:
|
|||||||
// Create the job
|
// Create the job
|
||||||
auto job = openpgp()->signKeyJob();//std::unique_ptr<SignKeyJob>{openpgp()->signKeyJob()};
|
auto job = openpgp()->signKeyJob();//std::unique_ptr<SignKeyJob>{openpgp()->signKeyJob()};
|
||||||
QVERIFY(job);
|
QVERIFY(job);
|
||||||
|
hookUpPassphraseProvider(job);
|
||||||
// Hack in the passphrase provider
|
|
||||||
auto jobCtx = Job::context(job);
|
|
||||||
TestPassphraseProvider provider;
|
|
||||||
jobCtx->setPassphraseProvider(&provider);
|
|
||||||
jobCtx->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
|
|
||||||
// Setup the job
|
// Setup the job
|
||||||
job->setExportable(true);
|
job->setExportable(true);
|
||||||
@ -492,12 +457,7 @@ private Q_SLOTS:
|
|||||||
// Create the job
|
// Create the job
|
||||||
auto job = openpgp()->signKeyJob();//std::unique_ptr<SignKeyJob>{openpgp()->signKeyJob()};
|
auto job = openpgp()->signKeyJob();//std::unique_ptr<SignKeyJob>{openpgp()->signKeyJob()};
|
||||||
QVERIFY(job);
|
QVERIFY(job);
|
||||||
|
hookUpPassphraseProvider(job);
|
||||||
// Hack in the passphrase provider
|
|
||||||
auto jobCtx = Job::context(job);
|
|
||||||
TestPassphraseProvider provider;
|
|
||||||
jobCtx->setPassphraseProvider(&provider);
|
|
||||||
jobCtx->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
|
|
||||||
// Setup the job
|
// Setup the job
|
||||||
job->setExportable(true);
|
job->setExportable(true);
|
||||||
|
@ -134,9 +134,7 @@ private Q_SLOTS:
|
|||||||
|
|
||||||
auto ctx = Context::createForProtocol(key.protocol());
|
auto ctx = Context::createForProtocol(key.protocol());
|
||||||
QVERIFY (ctx);
|
QVERIFY (ctx);
|
||||||
TestPassphraseProvider provider;
|
hookUpPassphraseProvider(ctx);
|
||||||
ctx->setPassphraseProvider(&provider);
|
|
||||||
ctx->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
|
|
||||||
QVERIFY(!ctx->addUid(key, uid));
|
QVERIFY(!ctx->addUid(key, uid));
|
||||||
delete ctx;
|
delete ctx;
|
||||||
@ -187,9 +185,7 @@ private Q_SLOTS:
|
|||||||
|
|
||||||
auto ctx = Context::createForProtocol(key.protocol());
|
auto ctx = Context::createForProtocol(key.protocol());
|
||||||
QVERIFY (ctx);
|
QVERIFY (ctx);
|
||||||
TestPassphraseProvider provider;
|
hookUpPassphraseProvider(ctx);
|
||||||
ctx->setPassphraseProvider(&provider);
|
|
||||||
ctx->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
|
|
||||||
// change expiration of the main key
|
// change expiration of the main key
|
||||||
QVERIFY(!ctx->setExpire(key, 1000));
|
QVERIFY(!ctx->setExpire(key, 1000));
|
||||||
@ -256,12 +252,7 @@ private Q_SLOTS:
|
|||||||
// Create the job
|
// Create the job
|
||||||
auto job = std::unique_ptr<SignKeyJob>{openpgp()->signKeyJob()};
|
auto job = std::unique_ptr<SignKeyJob>{openpgp()->signKeyJob()};
|
||||||
QVERIFY(job);
|
QVERIFY(job);
|
||||||
|
hookUpPassphraseProvider(job.get());
|
||||||
// Hack in the passphrase provider
|
|
||||||
auto jobCtx = Job::context(job.get());
|
|
||||||
TestPassphraseProvider provider;
|
|
||||||
jobCtx->setPassphraseProvider(&provider);
|
|
||||||
jobCtx->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
|
|
||||||
// Setup the job
|
// Setup the job
|
||||||
job->setExportable(true);
|
job->setExportable(true);
|
||||||
@ -316,12 +307,7 @@ private Q_SLOTS:
|
|||||||
// Create the job
|
// Create the job
|
||||||
auto job = std::unique_ptr<SignKeyJob>{openpgp()->signKeyJob()};
|
auto job = std::unique_ptr<SignKeyJob>{openpgp()->signKeyJob()};
|
||||||
QVERIFY(job);
|
QVERIFY(job);
|
||||||
|
hookUpPassphraseProvider(job.get());
|
||||||
// Hack in the passphrase provider
|
|
||||||
auto jobCtx = Job::context(job.get());
|
|
||||||
TestPassphraseProvider provider;
|
|
||||||
jobCtx->setPassphraseProvider(&provider);
|
|
||||||
jobCtx->setPinentryMode(Context::PinentryLoopback);
|
|
||||||
|
|
||||||
// Setup the job
|
// Setup the job
|
||||||
job->setExportable(true);
|
job->setExportable(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user