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>
This commit is contained in:
Justus Winter 2016-12-07 15:12:19 +01:00
parent 92df40a3a2
commit dec2ae31a4
1 changed files with 22 additions and 0 deletions

View File

@ -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)))