Listing an empty certificate store should not be an error.
- `sq cert list` on an empty certificate store should not be an error.
This commit is contained in:
parent
500447b804
commit
fde96e5790
@ -419,6 +419,10 @@ pub fn authenticate<'store, 'rstore>(
|
||||
.sq().arg("network").arg("search")
|
||||
.arg("some-mail-address")
|
||||
.done();
|
||||
|
||||
// We're listing everything and we have nothing. That's
|
||||
// not actually an error.
|
||||
return Ok(());
|
||||
}
|
||||
} else if bindings.len() - bindings_shown > 0 {
|
||||
// Some of the matching bindings were not shown. Tell the
|
||||
|
@ -39,3 +39,28 @@ fn list() {
|
||||
// When we use --email, then we don't do substring matching.
|
||||
assert!(sq.cert_list_maybe(&["--email", &email[1..]]).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn list_empty() {
|
||||
let sq = Sq::new();
|
||||
|
||||
// Listing an empty certificate store should not be an error.
|
||||
sq.cert_list(&[]);
|
||||
|
||||
// Listing an empty certificate store with a pattern (that doesn't
|
||||
// match anything) should be.
|
||||
assert!(sq.cert_list_maybe(&["not found"]).is_err());
|
||||
|
||||
let (cert, cert_path, _rev_path)
|
||||
= sq.key_generate(&[], &[ "alice" ]);
|
||||
sq.key_import(cert_path);
|
||||
|
||||
// Not linked => error.
|
||||
assert!(sq.cert_list_maybe(&["alice"]).is_err());
|
||||
// Not found => error.
|
||||
assert!(sq.cert_list_maybe(&["not found"]).is_err());
|
||||
|
||||
// Linked and found => ok.
|
||||
sq.pki_link_add(&[], cert.key_handle(), &["alice"]);
|
||||
sq.cert_list(&["alice"]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user