Fix test for sq pki link retract.

- Fix the user ID designator test for `sq pki link retract`.  It
    didn't actually test `sq pki link retract`.
This commit is contained in:
Neal H. Walfield 2024-12-12 23:04:00 +01:00
parent 09882042b1
commit d830691779
No known key found for this signature in database
GPG Key ID: 6863C9AD5B4D22D3

View File

@ -963,7 +963,8 @@ fn link_retract_userid_designators() {
&[], &fpr, UserIDArg::UserID("Alice <alice@example.org>")).is_ok());
sq.tick(1);
sq.pki_link_retract(&["--all"], cert.key_handle(), NO_USERIDS);
sq.pki_link_retract(&[], cert.key_handle(),
&[ UserIDArg::UserID("Alice <alice@example.org>") ]);
assert!(sq.pki_authenticate(
&[], &fpr, UserIDArg::UserID("Alice <alice@example.org>")).is_err());
@ -976,28 +977,33 @@ fn link_retract_userid_designators() {
&[], &fpr, UserIDArg::UserID("Alice <alice@example.com>")).is_ok());
sq.tick(1);
sq.pki_link_retract(&["--all"], cert.key_handle(), NO_USERIDS);
// But we can retract using --user "Alice <alice@example.com>".
sq.pki_link_retract(&[], cert.key_handle(),
&[ UserIDArg::UserID("Alice <alice@example.com>") ]);
assert!(sq.pki_authenticate(
&[], &fpr, UserIDArg::UserID("Alice <alice@example.com>")).is_err());
// 2. Retract using "--email". The email address must be part of
// a self-signed user ID, but it uses a user ID with just email
// a self-signed user ID, but it uses a user ID with just the email
// address.
// Link "<alice@example.org>", which is part of a self signed user
// Link "Alice <alice@example.org>", which is a self signed user
// ID.
sq.tick(1);
sq.pki_link_add(
&[], cert.key_handle(),
&[ UserIDArg::AddUserID("<alice@example.org>") ]);
&[ UserIDArg::UserID("Alice <alice@example.org>") ]);
assert!(sq.pki_authenticate(
&[], &fpr, UserIDArg::UserID("<alice@example.org>")).is_ok());
sq.tick(1);
sq.pki_link_retract(&["--all"], cert.key_handle(), NO_USERIDS);
&[], &fpr, UserIDArg::UserID("Alice <alice@example.org>")).is_ok());
assert!(sq.pki_authenticate(
&[], &fpr, UserIDArg::UserID("<alice@example.org>")).is_err());
sq.tick(1);
sq.pki_link_retract(&[], cert.key_handle(),
&[ UserIDArg::Email("alice@example.org") ]);
assert!(sq.pki_authenticate(
&[], &fpr, UserIDArg::UserID("Alice <alice@example.org>")).is_err());
// Link "<alice@example.com>", which is not part of a self signed
// user ID.
sq.tick(1);
@ -1008,7 +1014,8 @@ fn link_retract_userid_designators() {
&[], &fpr, UserIDArg::UserID("<alice@example.com>")).is_ok());
sq.tick(1);
sq.pki_link_retract(&["--all"], cert.key_handle(), NO_USERIDS);
sq.pki_link_retract(&[], cert.key_handle(),
&[ UserIDArg::Email("alice@example.com") ]);
assert!(sq.pki_authenticate(
&[], &fpr, UserIDArg::UserID("<alice@example.com>")).is_err());
}