[Pkg-gnupg-commit] [gnupg2] 65/180: tests: Add test for '--quick-set-expire'.
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Sat Dec 24 22:29:09 UTC 2016
This is an automated email from the git hooks/post-receive script.
dkg pushed a commit to branch master
in repository gnupg2.
commit dec2ae31a46a0f41886c7ad228865cc573f2dea9
Author: Justus Winter <justus at g10code.com>
Date: Wed Dec 7 15:12:19 2016 +0100
tests: Add test for '--quick-set-expire'.
* tests/openpgp/quick-key-manipulation.scm: Test '--quick-set-expire'.
Signed-off-by: Justus Winter <justus at g10code.com>
---
tests/openpgp/quick-key-manipulation.scm | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/tests/openpgp/quick-key-manipulation.scm b/tests/openpgp/quick-key-manipulation.scm
index 4f0eec2..d6bdde0 100755
--- a/tests/openpgp/quick-key-manipulation.scm
+++ b/tests/openpgp/quick-key-manipulation.scm
@@ -49,6 +49,9 @@
(assert (= 1 (count-uids-of-secret-key alpha)))
+(define fpr (list-ref (assoc "fpr" (gpg-with-colons `(-k ,(exact alpha))))
+ 9))
+
(info "Checking that we can add a user ID...")
;; Make sure the key capabilities don't change when we add a user id.
@@ -75,3 +78,22 @@
(call-check `(, at GPG --quick-revuid ,(exact bravo) ,alpha))
(assert (= 1 (count-uids-of-secret-key bravo)))
+
+(info "Checking that we can change the expiration time.")
+
+(define (expiration-time id)
+ (list-ref (assoc "pub" (gpg-with-colons `(-k ,id)))
+ 6))
+
+;; XXX This assumes that by default keys are created without
+;; expiration date. See issue2701.
+(assert (equal? "" (expiration-time fpr)))
+
+;; Make the key expire in one year.
+(call-check `(, at gpg --quick-set-expire ,fpr "1y"))
+;; XXX It'd be nice to check that the value is right.
+(assert (not (equal? "" (expiration-time fpr))))
+
+;; And remove the expiration date.
+(call-check `(, at gpg --quick-set-expire ,fpr "0"))
+(assert (equal? "" (expiration-time fpr)))
--
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