qt: Disable tests that require a password for 2.0
* lang/qt/tests/t-encrypt.cpp: Disable tests that require a password for 2.0. -- The passphrase_cb apparently does not work with 2.0 so we would need a fake pinentry to get this to work. We just disable the test instead as this is a rarely used feature and works with 1.4 and 2.1.
This commit is contained in:
parent
4984cc93db
commit
24779c9e23
@ -53,6 +53,23 @@
|
|||||||
using namespace QGpgME;
|
using namespace QGpgME;
|
||||||
using namespace GpgME;
|
using namespace GpgME;
|
||||||
|
|
||||||
|
static bool decryptSupported()
|
||||||
|
{
|
||||||
|
/* With GnuPG 2.0.x (at least 2.0.26 by default on jessie)
|
||||||
|
* the passphrase_cb does not work. So the test popped up
|
||||||
|
* a pinentry. So tests requiring decryption don't work. */
|
||||||
|
static auto version = GpgME::engineInfo(GpgME::GpgEngine).engineVersion();
|
||||||
|
if (version < "2.0.0") {
|
||||||
|
/* With 1.4 it just works */
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (version < "2.1.0") {
|
||||||
|
/* With 2.1 it works with loopback mode */
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
class EncryptionTest : public QGpgMETest
|
class EncryptionTest : public QGpgMETest
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -82,6 +99,9 @@ private Q_SLOTS:
|
|||||||
Q_ASSERT(cipherString.startsWith("-----BEGIN PGP MESSAGE-----"));
|
Q_ASSERT(cipherString.startsWith("-----BEGIN PGP MESSAGE-----"));
|
||||||
|
|
||||||
/* Now decrypt */
|
/* Now decrypt */
|
||||||
|
if (!decryptSupported()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
auto ctx = Context::createForProtocol(OpenPGP);
|
auto ctx = Context::createForProtocol(OpenPGP);
|
||||||
TestPassphraseProvider provider;
|
TestPassphraseProvider provider;
|
||||||
ctx->setPassphraseProvider(&provider);
|
ctx->setPassphraseProvider(&provider);
|
||||||
@ -150,6 +170,9 @@ private Q_SLOTS:
|
|||||||
|
|
||||||
void testSymmetricEncryptDecrypt()
|
void testSymmetricEncryptDecrypt()
|
||||||
{
|
{
|
||||||
|
if (!decryptSupported()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
auto ctx = Context::createForProtocol(OpenPGP);
|
auto ctx = Context::createForProtocol(OpenPGP);
|
||||||
TestPassphraseProvider provider;
|
TestPassphraseProvider provider;
|
||||||
ctx->setPassphraseProvider(&provider);
|
ctx->setPassphraseProvider(&provider);
|
||||||
@ -182,6 +205,9 @@ private:
|
|||||||
* So this test is disabled until gnupg(?) is fixed for this. */
|
* So this test is disabled until gnupg(?) is fixed for this. */
|
||||||
void testMixedEncryptDecrypt()
|
void testMixedEncryptDecrypt()
|
||||||
{
|
{
|
||||||
|
if (!decryptSupported()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
auto listjob = openpgp()->keyListJob(false, false, false);
|
auto listjob = openpgp()->keyListJob(false, false, false);
|
||||||
std::vector<Key> keys;
|
std::vector<Key> keys;
|
||||||
auto keylistresult = listjob->exec(QStringList() << QStringLiteral("alfa@example.net"),
|
auto keylistresult = listjob->exec(QStringList() << QStringLiteral("alfa@example.net"),
|
||||||
|
Loading…
Reference in New Issue
Block a user