[Pkg-gnupg-commit] [gnupg2] 08/30: tests: Move some functions into a common module.
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Wed Sep 6 21:57:30 UTC 2017
This is an automated email from the git hooks/post-receive script.
dkg pushed a commit to branch master
in repository gnupg2.
commit cbe54b28bf3610204e12c50c0606df37337a1156
Author: Damien Goutte-Gattat <dgouttegattat at incenp.org>
Date: Wed Jul 19 22:17:28 2017 +0200
tests: Move some functions into a common module.
* tests/openpgp/tofu.scm (gettrust): Moved to the common defs.scm
module.
(checktrust): Likewise.
* tests/openpgp/defs.scm (gettrust): New function.
(checktrust): Likewise.
--
These functions will be re-used by the tests for the PGP trust
model.
Signed-off-by: Damien Goutte-Gattat <dgouttegattat at incenp.org>
---
tests/openpgp/defs.scm | 24 ++++++++++++++++++++++++
tests/openpgp/tofu.scm | 24 ------------------------
2 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/tests/openpgp/defs.scm b/tests/openpgp/defs.scm
index 358efa6..f52f316 100644
--- a/tests/openpgp/defs.scm
+++ b/tests/openpgp/defs.scm
@@ -466,5 +466,29 @@
(catch (log "Warning: Removing socket directory failed.")
(gpg-conf '--remove-socketdir)))
+;; Get the trust level for KEYID. Any remaining arguments are simply
+;; passed to GPG.
+;;
+;; This function only supports keys with a single user id.
+(define (gettrust keyid . args)
+ (let ((trust
+ (list-ref (assoc "pub" (gpg-with-colons
+ `(, at args
+ --list-keys ,keyid))) 1)))
+ (unless (and (= 1 (string-length trust))
+ (member (string-ref trust 0) (string->list "oidreqnmfuws-")))
+ (fail "Bad trust value:" trust))
+ trust))
+
+;; Check that KEYID's trust level matches EXPECTED-TRUST. Any
+;; remaining arguments are simply passed to GPG.
+;;
+;; This function only supports keys with a single user id.
+(define (checktrust keyid expected-trust . args)
+ (let ((trust (apply gettrust `(,keyid , at args))))
+ (unless (string=? trust expected-trust)
+ (fail keyid ": Expected trust to be" expected-trust
+ "but got" trust))))
+
;; end
diff --git a/tests/openpgp/tofu.scm b/tests/openpgp/tofu.scm
index 58b2a03..cd4b4c7 100755
--- a/tests/openpgp/tofu.scm
+++ b/tests/openpgp/tofu.scm
@@ -71,30 +71,6 @@
(fail keyid ": Expected policy to be" expected-policy
"but got" policy))))
-;; Get the trust level for KEYID. Any remaining arguments are simply
-;; passed to GPG.
-;;
-;; This function only supports keys with a single user id.
-(define (gettrust keyid . args)
- (let ((trust
- (list-ref (assoc "pub" (gpg-with-colons
- `(, at args
- --list-keys ,keyid))) 1)))
- (unless (and (= 1 (string-length trust))
- (member (string-ref trust 0) (string->list "oidreqnmfuws-")))
- (fail "Bad trust value:" trust))
- trust))
-
-;; Check that KEYID's trust level matches EXPECTED-TRUST. Any
-;; remaining arguments are simply passed to GPG.
-;;
-;; This function only supports keys with a single user id.
-(define (checktrust keyid expected-trust . args)
- (let ((trust (apply gettrust `(,keyid , at args))))
- (unless (string=? trust expected-trust)
- (fail keyid ": Expected trust to be" expected-trust
- "but got" trust))))
-
;; Set key KEYID's policy to POLICY. Any remaining arguments are
;; passed as options to gpg.
(define (setpolicy keyid policy . args)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git
More information about the Pkg-gnupg-commit
mailing list