[Pkg-gnupg-commit] [gpgme] 324/412: qt: Enable signcount checks in tofuinfo test
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Thu Sep 22 21:27:12 UTC 2016
This is an automated email from the git hooks/post-receive script.
dkg pushed a commit to branch master
in repository gpgme.
commit 965b842fad6ec6fbd8902f3a32119abcd0728fe4
Author: Andre Heinecke <aheinecke at intevation.de>
Date: Mon Sep 5 12:58:35 2016 +0200
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.
---
lang/qt/tests/t-tofuinfo.cpp | 39 +++++++++++++++++++++++++++------------
1 file changed, 27 insertions(+), 12 deletions(-)
diff --git a/lang/qt/tests/t-tofuinfo.cpp b/lang/qt/tests/t-tofuinfo.cpp
index 30f7bea..f7238f3 100644
--- a/lang/qt/tests/t-tofuinfo.cpp
+++ b/lang/qt/tests/t-tofuinfo.cpp
@@ -89,13 +89,12 @@ class TofuInfoTest: public QGpgMETest
auto sigResult = job->exec(keys, what.toUtf8(), NormalSignatureMode, signedData);
delete job;
- auto info = keys[0].userID(0).tofuInfo();
- if (expected != -1) {
+ Q_ASSERT(!sigResult.error());
+ foreach (const auto uid, keys[0].userIDs()) {
+ auto info = uid.tofuInfo();
Q_ASSERT(info.signCount() == expected - 1);
}
- Q_ASSERT(!sigResult.error());
-
auto verifyJob = openpgp()->verifyOpaqueJob();
QByteArray verified;
@@ -114,9 +113,13 @@ class TofuInfoTest: public QGpgMETest
Q_ASSERT(!strcmp (key.primaryFingerprint(), sig.fingerprint()));
auto stats = key2.userID(0).tofuInfo();
Q_ASSERT(!stats.isNull());
- if (expected != -1) {
- Q_ASSERT(stats.signCount() == expected);
+ if (stats.signCount() != expected) {
+ std::cout << "################ Key before verify: "
+ << key
+ << "################ Key after verify: "
+ << key2;
}
+ Q_ASSERT(stats.signCount() == expected);
}
private Q_SLOTS:
@@ -218,6 +221,7 @@ private Q_SLOTS:
return;
}
auto *job = openpgp()->keyListJob(false, false, false);
+ job->addMode(GpgME::WithTofu);
std::vector<GpgME::Key> keys;
GpgME::KeyListResult result = job->exec(QStringList() << QStringLiteral("zulu at example.net"),
true, keys);
@@ -226,10 +230,13 @@ private Q_SLOTS:
Key key = keys[0];
Q_ASSERT(!key.isNull());
- signAndVerify(QStringLiteral("Hello"), key, -1);
- signAndVerify(QStringLiteral("Hello2"), key, -1);
- signAndVerify(QStringLiteral("Hello3"), key, -1);
- signAndVerify(QStringLiteral("Hello4"), key, -1);
+ signAndVerify(QStringLiteral("Hello"), key, 1);
+ key.update();
+ signAndVerify(QStringLiteral("Hello2"), key, 2);
+ key.update();
+ signAndVerify(QStringLiteral("Hello3"), key, 3);
+ key.update();
+ signAndVerify(QStringLiteral("Hello4"), key, 4);
}
void testTofuKeyList()
@@ -248,8 +255,16 @@ private Q_SLOTS:
auto key = keys[0];
Q_ASSERT(!key.isNull());
Q_ASSERT(key.userID(0).tofuInfo().isNull());
- signAndVerify(QStringLiteral("Hello"), key, -1);
- signAndVerify(QStringLiteral("Hello"), key, -1);
+ auto keyCopy = key;
+ 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 */
job = openpgp()->keyListJob(false, false, false);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gpgme.git
More information about the Pkg-gnupg-commit
mailing list