mirror of
git://git.gnupg.org/gnupg.git
synced 2024-11-09 21:28:51 +01:00
tests: Simplify test.
* tests/openpgp/quick-key-manipulation.scm: Avoid creating a temporary home directory, just make the uids unique. Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
parent
ca9597f080
commit
71158d8d5f
@ -33,55 +33,50 @@
|
|||||||
`(--with-fingerprint
|
`(--with-fingerprint
|
||||||
--list-secret-keys ,(exact id))))))
|
--list-secret-keys ,(exact id))))))
|
||||||
|
|
||||||
(define old-home (getenv "GNUPGHOME"))
|
(define alpha "Alpha <alpha@invalid.example.net>")
|
||||||
(define alpha "Alpha <alpha@example.net>")
|
(define bravo "Bravo <bravo@invalid.example.net>")
|
||||||
(define bravo "Bravo <bravo@example.net>")
|
|
||||||
|
|
||||||
(define (key-data key)
|
(define (key-data key)
|
||||||
(filter (lambda (x) (or (string=? (car x) "pub")
|
(filter (lambda (x) (or (string=? (car x) "pub")
|
||||||
(string=? (car x) "sub")))
|
(string=? (car x) "sub")))
|
||||||
(gpg-with-colons `(-k ,key))))
|
(gpg-with-colons `(-k ,key))))
|
||||||
|
|
||||||
(with-temporary-working-directory
|
(setenv "PINENTRY_USER_DATA" "test" #t)
|
||||||
(file-copy (path-join old-home "gpg.conf") "gpg.conf")
|
|
||||||
(file-copy (path-join old-home "gpg-agent.conf") "gpg-agent.conf")
|
|
||||||
(setenv "GNUPGHOME" "." #t)
|
|
||||||
(setenv "PINENTRY_USER_DATA" "test" #t)
|
|
||||||
|
|
||||||
(info "Checking quick key generation...")
|
(info "Checking quick key generation...")
|
||||||
(call-check `(,@GPG --quick-gen-key ,alpha))
|
(call-check `(,@GPG --quick-gen-key ,alpha))
|
||||||
|
|
||||||
(call-check `(,@GPG --check-trustdb)) ; XXX why?
|
(call-check `(,@GPG --check-trustdb)) ; XXX why?
|
||||||
|
|
||||||
(assert (= 1 (count-uids-of-secret-key alpha)))
|
(assert (= 1 (count-uids-of-secret-key alpha)))
|
||||||
|
|
||||||
(info "Checking that we can add a user ID...")
|
(info "Checking that we can add a user ID...")
|
||||||
|
|
||||||
;; Make sure the key capabilities don't change when we add a user id.
|
;; Make sure the key capabilities don't change when we add a user id.
|
||||||
;; (See bug #2697.)
|
;; (See bug #2697.)
|
||||||
(let ((pre (key-data (exact alpha)))
|
(let ((pre (key-data (exact alpha)))
|
||||||
(result (call-check `(,@GPG --quick-adduid ,(exact alpha) ,bravo)))
|
(result (call-check `(,@GPG --quick-adduid ,(exact alpha) ,bravo)))
|
||||||
(post (key-data (exact alpha))))
|
(post (key-data (exact alpha))))
|
||||||
(if (not (equal? pre post))
|
(if (not (equal? pre post))
|
||||||
(begin
|
(begin
|
||||||
(display "Key capabilities changed when adding a user id:")
|
(display "Key capabilities changed when adding a user id:")
|
||||||
(newline)
|
(newline)
|
||||||
(display " Pre: ")
|
(display " Pre: ")
|
||||||
(display pre)
|
(display pre)
|
||||||
(newline)
|
(newline)
|
||||||
(display " Post: ")
|
(display " Post: ")
|
||||||
(display post)
|
(display post)
|
||||||
(newline)
|
(newline)
|
||||||
(exit 1))))
|
(exit 1))))
|
||||||
|
|
||||||
(call-check `(,@GPG --check-trustdb)) ; XXX why?
|
(call-check `(,@GPG --check-trustdb)) ; XXX why?
|
||||||
|
|
||||||
(assert (= 2 (count-uids-of-secret-key alpha)))
|
(assert (= 2 (count-uids-of-secret-key alpha)))
|
||||||
(assert (= 2 (count-uids-of-secret-key bravo)))
|
(assert (= 2 (count-uids-of-secret-key bravo)))
|
||||||
|
|
||||||
(info "Checking that we can revoke a user ID...")
|
(info "Checking that we can revoke a user ID...")
|
||||||
(call-check `(,@GPG --quick-revuid ,(exact bravo) ,alpha))
|
(call-check `(,@GPG --quick-revuid ,(exact bravo) ,alpha))
|
||||||
|
|
||||||
(call-check `(,@GPG --check-trustdb)) ; XXX why?
|
(call-check `(,@GPG --check-trustdb)) ; XXX why?
|
||||||
|
|
||||||
(assert (= 1 (count-uids-of-secret-key bravo))))
|
(assert (= 1 (count-uids-of-secret-key bravo)))
|
||||||
|
Loading…
Reference in New Issue
Block a user