diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2018-08-27 12:07:36 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2018-08-27 14:06:02 +0200 |
commit | c898d0fb40506c7445234ca7aa9ea99317858cbb (patch) | |
tree | 267e1dbaa644e0e22fcd38701ba08b6daa90759a /tool/tests | |
parent | 67886fbad1d24b3aced8f4ecd9a87b5b8a9b73a6 (diff) |
tool: Ignore duplicate signatures in sqv.
- See #18.
Diffstat (limited to 'tool/tests')
-rw-r--r-- | tool/tests/sqv-duplicate-signatures.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tool/tests/sqv-duplicate-signatures.rs b/tool/tests/sqv-duplicate-signatures.rs new file mode 100644 index 00000000..691afb50 --- /dev/null +++ b/tool/tests/sqv-duplicate-signatures.rs @@ -0,0 +1,31 @@ +extern crate assert_cli; + +use assert_cli::Assert; + +fn p(filename: &str) -> String { + format!("../openpgp/tests/data/{}", filename) +} + +/// Asserts that duplicate signatures are properly ignored. +#[test] +fn ignore_duplicates() { + // Duplicate is ignored, but remaining one is ok. + Assert::cargo_binary("sqv") + .with_args( + &["-r", + &p("keys/emmelie-dorothea-dina-samantha-awina-ed25519.pgp"), + &p("messages/a-cypherpunks-manifesto.txt.ed25519.sig.duplicated"), + &p("messages/a-cypherpunks-manifesto.txt")]) + .unwrap(); + + // Duplicate is ignored, and fails to meet the threshold. + Assert::cargo_binary("sqv") + .with_args( + &["-r", + &p("keys/emmelie-dorothea-dina-samantha-awina-ed25519.pgp"), + "--signatures=2", + &p("messages/a-cypherpunks-manifesto.txt.ed25519.sig.duplicated"), + &p("messages/a-cypherpunks-manifesto.txt")]) + .fails() + .unwrap(); +} |