qt: Enable signcount checks in tofuinfo test
* lang/qt/tests/t-tofuinfo.cpp: Enable checks for signcount. -- Signcount for userIDs works now as expected with gnupg 2.1.16.
This commit is contained in:
parent
79439e76cc
commit
965b842fad
@ -89,13 +89,12 @@ class TofuInfoTest: public QGpgMETest
|
|||||||
auto sigResult = job->exec(keys, what.toUtf8(), NormalSignatureMode, signedData);
|
auto sigResult = job->exec(keys, what.toUtf8(), NormalSignatureMode, signedData);
|
||||||
delete job;
|
delete job;
|
||||||
|
|
||||||
auto info = keys[0].userID(0).tofuInfo();
|
Q_ASSERT(!sigResult.error());
|
||||||
if (expected != -1) {
|
foreach (const auto uid, keys[0].userIDs()) {
|
||||||
|
auto info = uid.tofuInfo();
|
||||||
Q_ASSERT(info.signCount() == expected - 1);
|
Q_ASSERT(info.signCount() == expected - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_ASSERT(!sigResult.error());
|
|
||||||
|
|
||||||
auto verifyJob = openpgp()->verifyOpaqueJob();
|
auto verifyJob = openpgp()->verifyOpaqueJob();
|
||||||
QByteArray verified;
|
QByteArray verified;
|
||||||
|
|
||||||
@ -114,9 +113,13 @@ class TofuInfoTest: public QGpgMETest
|
|||||||
Q_ASSERT(!strcmp (key.primaryFingerprint(), sig.fingerprint()));
|
Q_ASSERT(!strcmp (key.primaryFingerprint(), sig.fingerprint()));
|
||||||
auto stats = key2.userID(0).tofuInfo();
|
auto stats = key2.userID(0).tofuInfo();
|
||||||
Q_ASSERT(!stats.isNull());
|
Q_ASSERT(!stats.isNull());
|
||||||
if (expected != -1) {
|
if (stats.signCount() != expected) {
|
||||||
Q_ASSERT(stats.signCount() == expected);
|
std::cout << "################ Key before verify: "
|
||||||
|
<< key
|
||||||
|
<< "################ Key after verify: "
|
||||||
|
<< key2;
|
||||||
}
|
}
|
||||||
|
Q_ASSERT(stats.signCount() == expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
@ -218,6 +221,7 @@ private Q_SLOTS:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto *job = openpgp()->keyListJob(false, false, false);
|
auto *job = openpgp()->keyListJob(false, false, false);
|
||||||
|
job->addMode(GpgME::WithTofu);
|
||||||
std::vector<GpgME::Key> keys;
|
std::vector<GpgME::Key> keys;
|
||||||
GpgME::KeyListResult result = job->exec(QStringList() << QStringLiteral("zulu@example.net"),
|
GpgME::KeyListResult result = job->exec(QStringList() << QStringLiteral("zulu@example.net"),
|
||||||
true, keys);
|
true, keys);
|
||||||
@ -226,10 +230,13 @@ private Q_SLOTS:
|
|||||||
Key key = keys[0];
|
Key key = keys[0];
|
||||||
Q_ASSERT(!key.isNull());
|
Q_ASSERT(!key.isNull());
|
||||||
|
|
||||||
signAndVerify(QStringLiteral("Hello"), key, -1);
|
signAndVerify(QStringLiteral("Hello"), key, 1);
|
||||||
signAndVerify(QStringLiteral("Hello2"), key, -1);
|
key.update();
|
||||||
signAndVerify(QStringLiteral("Hello3"), key, -1);
|
signAndVerify(QStringLiteral("Hello2"), key, 2);
|
||||||
signAndVerify(QStringLiteral("Hello4"), key, -1);
|
key.update();
|
||||||
|
signAndVerify(QStringLiteral("Hello3"), key, 3);
|
||||||
|
key.update();
|
||||||
|
signAndVerify(QStringLiteral("Hello4"), key, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void testTofuKeyList()
|
void testTofuKeyList()
|
||||||
@ -248,8 +255,16 @@ private Q_SLOTS:
|
|||||||
auto key = keys[0];
|
auto key = keys[0];
|
||||||
Q_ASSERT(!key.isNull());
|
Q_ASSERT(!key.isNull());
|
||||||
Q_ASSERT(key.userID(0).tofuInfo().isNull());
|
Q_ASSERT(key.userID(0).tofuInfo().isNull());
|
||||||
signAndVerify(QStringLiteral("Hello"), key, -1);
|
auto keyCopy = key;
|
||||||
signAndVerify(QStringLiteral("Hello"), key, -1);
|
keyCopy.update();
|
||||||
|
auto sigCnt = keyCopy.userID(0).tofuInfo().signCount();
|
||||||
|
signAndVerify(QStringLiteral("Hello"), keyCopy,
|
||||||
|
sigCnt + 1);
|
||||||
|
keyCopy.update();
|
||||||
|
/* For some reason if you remove the " World" part of
|
||||||
|
* the next message the test fails. */
|
||||||
|
signAndVerify(QStringLiteral("Hello World"), keyCopy,
|
||||||
|
sigCnt + 2);
|
||||||
|
|
||||||
/* Now another one but with tofu */
|
/* Now another one but with tofu */
|
||||||
job = openpgp()->keyListJob(false, false, false);
|
job = openpgp()->keyListJob(false, false, false);
|
||||||
|
Loading…
Reference in New Issue
Block a user