| 1 |
use crate::integration::common::Sq; |
| 2 |
|
| 3 |
#[test] |
| 4 |
fn list_empty() { |
| 5 |
let sq = Sq::new(); |
| 6 |
|
| 7 |
// Listing an empty key store should not be an error. |
| 8 |
sq.key_list(&[]); |
| 9 |
|
| 10 |
// Listing an empty key store with a pattern (that doesn't |
| 11 |
// match anything) should be. |
| 12 |
assert!(sq.try_key_list(&["not found"]).is_err()); |
| 13 |
|
| 14 |
let (cert, cert_path, _rev_path) |
| 15 |
= sq.key_generate(&[], &[ "alice" ]); |
| 16 |
sq.key_import(cert_path); |
| 17 |
|
| 18 |
// Not linked => ok. |
| 19 |
sq.key_list(&["alice"]); |
| 20 |
// Not found => error. |
| 21 |
assert!(sq.try_key_list(&["not found"]).is_err()); |
| 22 |
|
| 23 |
// Linked and found => ok. |
| 24 |
sq.pki_link_add(&[], cert.key_handle(), &["alice"]); |
| 25 |
sq.key_list(&["alice"]); |
| 26 |
|
| 27 |
// Not found => error. |
| 28 |
assert!(sq.try_key_list(&["not found"]).is_err()); |
| 29 |
} |