summaryrefslogtreecommitdiffstats
path: root/tool/tests
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2018-08-27 13:58:00 +0200
committerJustus Winter <justus@sequoia-pgp.org>2018-08-27 14:06:02 +0200
commit75b61f44754ef3a6b363d5f0ec1f11954982fbdb (patch)
tree301794875b038f549dae13fa99213b69704ab45c /tool/tests
parent955423066b3320dde20923bf2dddaf26a0970c01 (diff)
tool: Ignore multiple signatures from the same TPK by default.
- This behavior can be changed using a switch. - Fixes #18.
Diffstat (limited to 'tool/tests')
-rw-r--r--tool/tests/sqv-multiple-signatures.rs36
1 files changed, 36 insertions, 0 deletions
diff --git a/tool/tests/sqv-multiple-signatures.rs b/tool/tests/sqv-multiple-signatures.rs
new file mode 100644
index 00000000..b7ebb8f9
--- /dev/null
+++ b/tool/tests/sqv-multiple-signatures.rs
@@ -0,0 +1,36 @@
+extern crate assert_cli;
+
+use assert_cli::Assert;
+
+fn p(filename: &str) -> String {
+ format!("../openpgp/tests/data/{}", filename)
+}
+
+/// Asserts that multiple signatures from the same TPK are properly
+/// ignored.
+#[test]
+fn ignore_multiple_signatures() {
+ // Check that all signatures are ok and accounted for.
+ Assert::cargo_binary("sqv")
+ .with_args(
+ &["-r",
+ &p("keys/emmelie-dorothea-dina-samantha-awina-ed25519.pgp"),
+ "--signatures=2",
+ "--accept-multiple-signatures",
+ &p("messages/a-cypherpunks-manifesto.txt.ed25519.sig.two-keys"),
+ &p("messages/a-cypherpunks-manifesto.txt")])
+ .unwrap();
+
+
+ // Multiple signatures from the same TPK are 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();
+}