tests: Remove/change tests for GnuPG 2.3 with no gpg.keyserver.

* lang/qt/tests/t-config.cpp (testKeyserver): Remove.
* tests/gpg/t-gpgconf.c (main): Test with dirmngr.keyserver.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2020-05-11 14:20:48 +09:00
parent 52f930c1ed
commit 0cc040e82f
2 changed files with 4 additions and 34 deletions

View File

@ -50,36 +50,6 @@ class CryptoConfigTest: public QGpgMETest
Q_OBJECT Q_OBJECT
private Q_SLOTS: private Q_SLOTS:
void testKeyserver()
{
// Repeatedly set a config value and clear it
// this was broken at some point so it gets a
// unit test.
for (int i = 0; i < 10; i++) {
auto conf = cryptoConfig();
QVERIFY(conf);
auto entry = conf->entry(QStringLiteral("gpg"),
QStringLiteral("Keyserver"),
QStringLiteral("keyserver"));
QVERIFY(entry);
const QString url(QStringLiteral("hkp://foo.bar.baz"));
entry->setStringValue(url);
conf->sync(false);
conf->clear();
entry = conf->entry(QStringLiteral("gpg"),
QStringLiteral("Keyserver"),
QStringLiteral("keyserver"));
QCOMPARE (entry->stringValue(), url);
entry->setStringValue(QString());
conf->sync(false);
conf->clear();
entry = conf->entry(QStringLiteral("gpg"),
QStringLiteral("Keyserver"),
QStringLiteral("keyserver"));
QCOMPARE (entry->stringValue(), QString());
}
}
void testDefault() void testDefault()
{ {
if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.2.0") { if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.2.0") {

View File

@ -340,7 +340,7 @@ main (void)
} }
/* Now change something else. */ /* Now change something else. */
fprintf (stderr, " gpg.keyserver "); fprintf (stderr, " dirmngr.keyserver ");
for (i = 0; i < N; i++) { for (i = 0; i < N; i++) {
const char *values[2] = { "hkp://foo.bar", "hkps://bar.foo" }; const char *values[2] = { "hkp://foo.bar", "hkps://bar.foo" };
gpgme_conf_arg_t arg; gpgme_conf_arg_t arg;
@ -349,7 +349,7 @@ main (void)
err = gpgme_conf_arg_new (&arg, GPGME_CONF_STRING, values[i%2]); err = gpgme_conf_arg_new (&arg, GPGME_CONF_STRING, values[i%2]);
fail_if_err (err); fail_if_err (err);
if (lookup (conf, "gpg", "keyserver", &comp, &opt)) if (lookup (conf, "dirmngr", "keyserver", &comp, &opt))
{ {
/* Found. */ /* Found. */
test (opt->alt_type == GPGME_CONF_STRING); test (opt->alt_type == GPGME_CONF_STRING);
@ -361,7 +361,7 @@ main (void)
} }
else else
{ {
fprintf (stderr, "Skipping test, option gpg.keyserver not found.\n"); fprintf (stderr, "Skipping test, option dirmngr.keyserver not found.\n");
break; break;
} }
@ -369,7 +369,7 @@ main (void)
gpgme_conf_release (conf); gpgme_conf_release (conf);
err = gpgme_op_conf_load (ctx, &conf); err = gpgme_op_conf_load (ctx, &conf);
fail_if_err (err); fail_if_err (err);
if (lookup (conf, "gpg", "keyserver", &comp, &opt)) if (lookup (conf, "dirmngr", "keyserver", &comp, &opt))
{ {
/* Found. */ /* Found. */
test (opt->alt_type == GPGME_CONF_STRING); test (opt->alt_type == GPGME_CONF_STRING);