sequoia-sq/tests/integration/sq_pki_link_list.rs
Neal H. Walfield f0e73deb7f
Add tests for sq pki link list.
- Add tests that check that `sq pki link list` returns an
    appropriate error code.

  - See #484.
2024-12-04 11:22:23 +01:00

31 lines
859 B
Rust

use crate::integration::common::Sq;
#[test]
fn list_empty() {
let sq = Sq::new();
// Listing an empty key store should not be an error.
sq.pki_link_list(&[]);
// Listing an empty key store with a pattern (that doesn't
// match anything) should be.
assert!(sq.try_pki_link_list(&["not found"]).is_err());
let (cert, cert_path, _rev_path)
= sq.key_generate(&[], &[ "alice" ]);
sq.key_import(cert_path);
// Not linked => error.
// Reenable when the following issue is fixed:
// https://gitlab.com/sequoia-pgp/sequoia-sq/-/issues/484
//assert!(sq.try_pki_link_list(&["alice"]).is_err());
// Not found => error.
assert!(sq.try_pki_link_list(&["not found"]).is_err());
// Linked and found => ok.
sq.pki_link_add(&[], cert.key_handle(), &["alice"]);
sq.pki_link_list(&["alice"]);
}