summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@g10code.com>2016-12-07 15:12:19 +0100
committerJustus Winter <justus@g10code.com>2016-12-07 15:12:19 +0100
commitdec2ae31a46a0f41886c7ad228865cc573f2dea9 (patch)
tree612c4c621abd61d200a0d0f9f97f85176570b7af
parenttests: Improve quick key manipulation test. (diff)
downloadgnupg2-dec2ae31a46a0f41886c7ad228865cc573f2dea9.tar.xz
gnupg2-dec2ae31a46a0f41886c7ad228865cc573f2dea9.zip
tests: Add test for '--quick-set-expire'.
* tests/openpgp/quick-key-manipulation.scm: Test '--quick-set-expire'. Signed-off-by: Justus Winter <justus@g10code.com>
-rwxr-xr-xtests/openpgp/quick-key-manipulation.scm22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/openpgp/quick-key-manipulation.scm b/tests/openpgp/quick-key-manipulation.scm
index 4f0eec292..d6bdde0bc 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 `(,@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 `(,@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 `(,@gpg --quick-set-expire ,fpr "0"))
+(assert (equal? "" (expiration-time fpr)))