summaryrefslogtreecommitdiffstats
path: root/sq
diff options
context:
space:
mode:
authorNora Widdecke <nora@sequoia-pgp.org>2021-12-02 21:48:59 +0100
committerNora Widdecke <nora@sequoia-pgp.org>2022-02-25 12:51:57 +0100
commit0fb0297f0297cf6c048216a357d65a3689a0bdb5 (patch)
tree222dae252baae42cc425cddb8f1732d6b6f7d4a0 /sq
parent2c5c40988d692fc8eb6421e8ed33dec471c73235 (diff)
sq: Use only assert_cmd.
- assert_cli has been deprecated for a long time, assert_cmd is the successor. - a4cfd15805a543a327d2242f9c0f2b653a11ee55 introduced assert_cmd to sq, in addition to assert_cli. It does not make sense to use two different crates for cli testing. - Closes #640.
Diffstat (limited to 'sq')
-rw-r--r--sq/Cargo.toml4
-rw-r--r--sq/tests/sq-certify.rs127
-rw-r--r--sq/tests/sq-key-adopt.rs208
-rw-r--r--sq/tests/sq-sign.rs557
4 files changed, 438 insertions, 458 deletions
diff --git a/sq/Cargo.toml b/sq/Cargo.toml
index 2d9a29b5..297f9412 100644
--- a/sq/Cargo.toml
+++ b/sq/Cargo.toml
@@ -45,10 +45,10 @@ sequoia-openpgp = { path = "../openpgp", version = "1.0.0", default-features = f
subplot-build = "0.1.0"
[dev-dependencies]
-assert_cli = "0.6"
-assert_cmd = "2.0.4"
subplotlib = "0.1.0"
fehler = "1.0.0"
+assert_cmd = "2.0.4"
+predicates = "2"
[[bin]]
name = "sq"
diff --git a/sq/tests/sq-certify.rs b/sq/tests/sq-certify.rs
index b6a670d8..4cbd0a9c 100644
--- a/sq/tests/sq-certify.rs
+++ b/sq/tests/sq-certify.rs
@@ -2,9 +2,9 @@ use std::fs::File;
use std::time;
use std::time::Duration;
-use assert_cli::Assert;
-use assert_cmd::Command;
use tempfile::TempDir;
+use assert_cmd::Command;
+use predicates::prelude::*;
use sequoia_openpgp as openpgp;
use openpgp::Result;
@@ -38,14 +38,15 @@ fn sq_certify() -> Result<()> {
// A simple certification.
- Assert::cargo_binary("sq")
- .with_args(
- &["certify",
- alice_pgp.to_str().unwrap(),
- bob_pgp.to_str().unwrap(),
- "bob@example.org",
- ])
- .stdout().satisfies(|output| {
+ Command::cargo_bin("sq")
+ .unwrap()
+ .arg("certify")
+ .arg(alice_pgp.to_str().unwrap())
+ .arg(bob_pgp.to_str().unwrap())
+ .arg("bob@example.org")
+ .assert()
+ .success()
+ .stdout(predicate::function(|output: &[u8]| -> bool {
let cert = Cert::from_bytes(output).unwrap();
let vc = cert.with_policy(P, None).unwrap();
@@ -66,22 +67,21 @@ fn sq_certify() -> Result<()> {
return true;
}
}
-
false
},
- "Bad certification")
- .unwrap();
+ ));
// No expiry.
- Assert::cargo_binary("sq")
- .with_args(
- &["certify",
- alice_pgp.to_str().unwrap(),
- bob_pgp.to_str().unwrap(),
- "bob@example.org",
- "--expires", "never"
- ])
- .stdout().satisfies(|output| {
+ Command::cargo_bin("sq")
+ .unwrap()
+ .arg("certify")
+ .arg(alice_pgp.to_str().unwrap())
+ .arg(bob_pgp.to_str().unwrap())
+ .arg("bob@example.org")
+ .args(["--expires", "never"])
+ .assert()
+ .success()
+ .stdout(predicate::function(|output: &[u8]| -> bool {
let cert = Cert::from_bytes(output).unwrap();
let vc = cert.with_policy(P, None).unwrap();
@@ -103,26 +103,25 @@ fn sq_certify() -> Result<()> {
}
false
- },
- "Bad certification")
- .unwrap();
+ }));
// Have alice certify bob@example.org for 0xB0B.
- Assert::cargo_binary("sq")
- .with_args(
- &["certify",
- alice_pgp.to_str().unwrap(),
- bob_pgp.to_str().unwrap(),
- "bob@example.org",
- "--depth", "10",
- "--amount", "5",
- "--regex", "a",
- "--regex", "b",
- "--local",
- "--non-revocable",
- "--expires-in", "1d",
- ])
- .stdout().satisfies(|output| {
+ Command::cargo_bin("sq")
+ .unwrap()
+ .arg("certify")
+ .arg(alice_pgp.to_str().unwrap())
+ .arg(bob_pgp.to_str().unwrap())
+ .arg("bob@example.org")
+ .args(["--depth", "10"])
+ .args(["--amount", "5"])
+ .args(["--regex", "a"])
+ .args(["--regex", "b"])
+ .arg("--local")
+ .arg("--non-revocable")
+ .args(["--expires-in", "1d"])
+ .assert()
+ .success()
+ .stdout(predicate::function(|output: &[u8]| -> bool {
let cert = Cert::from_bytes(output).unwrap();
let vc = cert.with_policy(P, None).unwrap();
@@ -146,33 +145,31 @@ fn sq_certify() -> Result<()> {
}
false
- },
- "Bad certification")
- .unwrap();
+ }));
// It should fail if the User ID doesn't exist.
- Assert::cargo_binary("sq")
- .with_args(
- &["certify",
- alice_pgp.to_str().unwrap(),
- bob_pgp.to_str().unwrap(),
- "bob",
- ])
- .fails()
- .unwrap();
+ Command::cargo_bin("sq")
+ .unwrap()
+ .arg("certify")
+ .arg(alice_pgp.to_str().unwrap())
+ .arg(bob_pgp.to_str().unwrap())
+ .arg("bob")
+ .assert()
+ .failure();
// With a notation.
- Assert::cargo_binary("sq")
- .with_args(
- &["certify",
- "--notation", "foo", "bar",
- "--notation", "!foo", "xyzzy",
- "--notation", "hello@example.org", "1234567890",
- alice_pgp.to_str().unwrap(),
- bob_pgp.to_str().unwrap(),
- "bob@example.org",
- ])
- .stdout().satisfies(|output| {
+ Command::cargo_bin("sq")
+ .unwrap()
+ .arg("certify")
+ .args(["--notation", "foo", "bar"])
+ .args(["--notation", "!foo", "xyzzy"])
+ .args(["--notation", "hello@example.org", "1234567890"])
+ .arg(alice_pgp.to_str().unwrap())
+ .arg(bob_pgp.to_str().unwrap())
+ .arg("bob@example.org")
+ .assert()
+ .success()
+ .stdout(predicate::function(|output: &[u8]| -> bool {
let cert = Cert::from_bytes(output).unwrap();
// The standard policy will reject the
@@ -239,9 +236,7 @@ fn sq_certify() -> Result<()> {
}
false
- },
- "Bad certification")
- .unwrap();
+ }));
Ok(())
}
diff --git a/sq/tests/sq-key-adopt.rs b/sq/tests/sq-key-adopt.rs
index 5bb40f32..b3097f14 100644
--- a/sq/tests/sq-key-adopt.rs
+++ b/sq/tests/sq-key-adopt.rs
@@ -2,7 +2,8 @@
mod integration {
use std::path;
- use assert_cli::Assert;
+ use assert_cmd::Command;
+ use predicates::prelude::*;
use sequoia_openpgp as openpgp;
@@ -140,15 +141,15 @@ mod integration {
#[test]
fn adopt_encryption() -> Result<()> {
// Adopt an encryption subkey.
- Assert::cargo_binary("sq").with_args(&[
- "key", "adopt",
- bob().to_str().unwrap(),
- "--keyring", alice().to_str().unwrap(),
- "--key", &alice_encryption().0.to_hex(),
- ]).stdout().satisfies(|output| {
- check(output.as_bytes(), 2, (bob_primary(), &[alice_encryption()]))
- .is_ok()
- }, "check failed").unwrap();
+ Command::cargo_bin("sq").unwrap().arg("key").arg("adopt")
+ .arg(bob())
+ .arg("--keyring").arg(alice())
+ .arg("--key").arg(alice_encryption().0.to_hex())
+ .assert()
+ .code(0)
+ .stdout(predicate::function(|output: &[u8]| -> bool {
+ check(output, 2, (bob_primary(), &[alice_encryption()])).is_ok()
+ }));
Ok(())
}
@@ -156,15 +157,15 @@ mod integration {
#[test]
fn adopt_signing() -> Result<()> {
// Adopt a signing subkey (subkey has secret key material).
- Assert::cargo_binary("sq").with_args(&[
- "key", "adopt",
- bob().to_str().unwrap(),
- "--keyring", alice().to_str().unwrap(),
- "--key", &alice_signing().0.to_hex(),
- ]).stdout().satisfies(|output| {
- check(output.as_bytes(), 2, (bob_primary(), &[alice_signing()]))
- .is_ok()
- }, "check failed").unwrap();
+ Command::cargo_bin("sq").unwrap().arg("key").arg("adopt")
+ .arg(bob())
+ .arg("--keyring").arg(alice())
+ .arg("--key").arg(alice_signing().0.to_hex())
+ .assert()
+ .code(0)
+ .stdout(predicate::function(|output: &[u8]| -> bool {
+ check(output, 2, (bob_primary(), &[alice_signing()])).is_ok()
+ }));
Ok(())
}
@@ -172,15 +173,15 @@ mod integration {
#[test]
fn adopt_certification() -> Result<()> {
// Adopt a certification subkey (subkey has secret key material).
- Assert::cargo_binary("sq").with_args(&[
- "key", "adopt",
- carol().to_str().unwrap(),
- "--keyring", alice().to_str().unwrap(),
- "--key", &alice_primary().0.to_hex(),
- ]).stdout().satisfies(|output| {
- check(output.as_bytes(), 4, (carol_primary(), &[alice_primary()]))
- .is_ok()
- }, "check failed").unwrap();
+ Command::cargo_bin("sq").unwrap().arg("key").arg("adopt")
+ .arg(carol())
+ .arg("--keyring").arg(alice())
+ .arg("--key").arg(alice_primary().0.to_hex())
+ .assert()
+ .code(0)
+ .stdout(predicate::function(|output: &[u8]| -> bool {
+ check(output, 4, (carol_primary(), &[alice_primary()])).is_ok()
+ }));
Ok(())
}
@@ -188,18 +189,19 @@ mod integration {
#[test]
fn adopt_encryption_and_signing() -> Result<()> {
// Adopt an encryption subkey and a signing subkey.
- Assert::cargo_binary("sq").with_args(&[
- "key", "adopt",
- bob().to_str().unwrap(),
- "--keyring", alice().to_str().unwrap(),
- "--key", &alice_signing().0.to_hex(),
- "--key", &alice_encryption().0.to_hex(),
- ]).stdout().satisfies(|output| {
- check(output.as_bytes(), 3,
- (bob_primary(),
- &[alice_signing(), alice_encryption()]))
- .is_ok()
- }, "check failed").unwrap();
+ Command::cargo_bin("sq").unwrap().arg("key").arg("adopt")
+ .arg(bob())
+ .arg("--keyring").arg(alice())
+ .arg("--key").arg(alice_signing().0.to_hex())
+ .arg("--key").arg(alice_encryption().0.to_hex())
+ .assert()
+ .code(0)
+ .stdout(predicate::function(|output: &[u8]| -> bool {
+ check(output, 3,
+ (bob_primary(),
+ &[alice_signing(), alice_encryption()]))
+ .is_ok()
+ }));
Ok(())
}
@@ -207,16 +209,16 @@ mod integration {
#[test]
fn adopt_twice() -> Result<()> {
// Adopt the same an encryption subkey twice.
- Assert::cargo_binary("sq").with_args(&[
- "key", "adopt",
- bob().to_str().unwrap(),
- "--keyring", alice().to_str().unwrap(),
- "--key", &alice_encryption().0.to_hex(),
- "--key", &alice_encryption().0.to_hex(),
- ]).stdout().satisfies(|output| {
- check(output.as_bytes(), 2, (bob_primary(), &[alice_encryption()]))
- .is_ok()
- }, "check failed").unwrap();
+ Command::cargo_bin("sq").unwrap().arg("key").arg("adopt")
+ .arg(bob())
+ .arg("--keyring").arg(alice())
+ .arg("--key").arg(alice_encryption().0.to_hex())
+ .arg("--key").arg(alice_encryption().0.to_hex())
+ .assert()
+ .code(0)
+ .stdout(predicate::function(|output: &[u8]| -> bool {
+ check(output, 2, (bob_primary(), &[alice_encryption()])).is_ok()
+ }));
Ok(())
}
@@ -224,16 +226,16 @@ mod integration {
#[test]
fn adopt_key_appears_twice() -> Result<()> {
// Adopt the an encryption subkey that appears twice.
- Assert::cargo_binary("sq").with_args(&[
- "key", "adopt",
- bob().to_str().unwrap(),
- "--keyring", alice().to_str().unwrap(),
- "--keyring", alice().to_str().unwrap(),
- "--key", &alice_encryption().0.to_hex(),
- ]).stdout().satisfies(|output| {
- check(output.as_bytes(), 2, (bob_primary(), &[alice_encryption()]))
- .is_ok()
- }, "check failed").unwrap();
+ Command::cargo_bin("sq").unwrap().arg("key").arg("adopt")
+ .arg(bob())
+ .arg("--keyring").arg(alice())
+ .arg("--keyring").arg(alice())
+ .arg("--key").arg(alice_encryption().0.to_hex())
+ .assert()
+ .code(0)
+ .stdout(predicate::function(|output: &[u8]| -> bool {
+ check(output, 2, (bob_primary(), &[alice_encryption()])).is_ok()
+ }));
Ok(())
}
@@ -241,16 +243,15 @@ mod integration {
#[test]
fn adopt_own_encryption() -> Result<()> {
// Adopt its own encryption subkey. This should be a noop.
- Assert::cargo_binary("sq").with_args(&[
- "key", "adopt",
- alice().to_str().unwrap(),
- "--keyring", alice().to_str().unwrap(),
- "--key", &alice_encryption().0.to_hex(),
- ]).stdout().satisfies(|output| {
- check(output.as_bytes(), 3, (alice_primary(),
- &[alice_encryption()]))
- .is_ok()
- }, "check failed").unwrap();
+ Command::cargo_bin("sq").unwrap().arg("key").arg("adopt")
+ .arg(alice())
+ .arg("--keyring").arg(alice())
+ .arg("--key").arg(alice_encryption().0.to_hex())
+ .assert()
+ .code(0)
+ .stdout(predicate::function(|output: &[u8]| -> bool {
+ check(output, 3, (alice_primary(), &[alice_encryption()])).is_ok()
+ }));
Ok(())
}
@@ -258,15 +259,15 @@ mod integration {
#[test]
fn adopt_own_primary() -> Result<()> {
// Adopt own primary key.
- Assert::cargo_binary("sq").with_args(&[
- "key", "adopt",
- bob().to_str().unwrap(),
- "--keyring", bob().to_str().unwrap(),
- "--key", &bob_primary().0.to_hex(),
- ]).stdout().satisfies(|output| {
- check(output.as_bytes(), 2, (bob_primary(), &[bob_primary()]))
- .is_ok()
- }, "check failed").unwrap();
+ Command::cargo_bin("sq").unwrap().arg("key").arg("adopt")
+ .arg(bob())
+ .arg("--keyring").arg(bob())
+ .arg("--key").arg(bob_primary().0.to_hex())
+ .assert()
+ .code(0)
+ .stdout(predicate::function(|output: &[u8]| -> bool {
+ check(output, 2, (bob_primary(), &[bob_primary()])).is_ok()
+ }));
Ok(())
}
@@ -274,12 +275,12 @@ mod integration {
#[test]
fn adopt_missing() -> Result<()> {
// Adopt a key that is not present.
- Assert::cargo_binary("sq").with_args(&[
- "key", "adopt",
- bob().to_str().unwrap(),
- "--keyring", bob().to_str().unwrap(),
- "--key", "1234 5678 90AB CDEF 1234 5678 90AB CDEF"
- ]).fails().unwrap();
+ Command::cargo_bin("sq").unwrap().arg("key").arg("adopt")
+ .arg(bob())
+ .arg("--keyring").arg(bob())
+ .arg("--key").arg("1234 5678 90AB CDEF 1234 5678 90AB CDEF")
+ .assert()
+ .code(1);
Ok(())
}
@@ -287,24 +288,25 @@ mod integration {
#[test]
fn adopt_from_multiple() -> Result<()> {
// Adopt from multiple certificates simultaneously.
- Assert::cargo_binary("sq").with_args(&[
- "key", "adopt",
- bob().to_str().unwrap(),
- "--keyring", alice().to_str().unwrap(),
- "--key", &alice_signing().0.to_hex(),
- "--key", &alice_encryption().0.to_hex(),
- "--keyring", carol().to_str().unwrap(),
- "--key", &carol_signing().0.to_hex(),
- "--key", &carol_encryption().0.to_hex(),
- ]).stdout().satisfies(|output| {
- check(output.as_bytes(), 5,
- (bob_primary(),
- &[
- alice_signing(), alice_encryption(),
- carol_signing(), carol_encryption()
- ]))
- .is_ok()
- }, "check failed").unwrap();
+ Command::cargo_bin("sq").unwrap().arg("key").arg("adopt")
+ .arg(bob())
+ .arg("--keyring").arg(alice())
+ .arg("--key").arg(alice_signing().0.to_hex())
+ .arg("--key").arg(alice_encryption().0.to_hex())
+ .arg("--keyring").arg(carol())
+ .arg("--key").arg(carol_signing().0.to_hex())
+ .arg("--key").arg(carol_encryption().0.to_hex())
+ .assert()
+ .code(0)
+ .stdout(predicate::function(|output: &[u8]| -> bool {
+ check(output, 5,
+ (bob_primary(),
+ &[
+ alice_signing(), alice_encryption(),
+ carol_signing(), carol_encryption()
+ ]))
+ .is_ok()
+ }));
Ok(())
}
diff --git a/sq/tests/sq-sign.rs b/sq/tests/sq-sign.rs
index 97d0a40b..b9208c8a 100644
--- a/sq/tests/sq-sign.rs
+++ b/sq/tests/sq-sign.rs
@@ -1,9 +1,8 @@
use std::fs::{self, File};
use std::io;
-use assert_cmd::Command;
-use assert_cli::Assert;
use tempfile::TempDir;
+use assert_cmd::Command;
use sequoia_openpgp as openpgp;
use openpgp::Fingerprint;
@@ -33,15 +32,14 @@ fn sq_sign() {
let sig = tmp_dir.path().join("sig0");
// Sign message.
- Assert::cargo_binary("sq")
- .with_args(
- &["sign",
- "--signer-key",
- &artifact("keys/dennis-simon-anton-private.pgp"),
- "--output",
- &sig.to_string_lossy(),
- &artifact("messages/a-cypherpunks-manifesto.txt")])
- .unwrap();
+ Command::cargo_bin("sq")
+ .unwrap()
+ .arg("sign")
+ .args(["--signer-key", &artifact("keys/dennis-simon-anton-private.pgp")])
+ .args(["--output", &sig.to_string_lossy()])
+ .arg(&artifact("messages/a-cypherpunks-manifesto.txt"))
+ .assert()
+ .success();
// Check that the content is sane.
let packets: Vec<Packet> =
@@ -68,13 +66,13 @@ fn sq_sign() {
assert!(&content[..].starts_with(b"-----BEGIN PGP MESSAGE-----\n\n"));
// Verify signed message.
- Assert::cargo_binary("sq")
- .with_args(
- &["verify",
- "--signer-cert",
- &artifact("keys/dennis-simon-anton.pgp"),
- &sig.to_string_lossy()])
- .unwrap();
+ Command::cargo_bin("sq")
+ .unwrap()
+ .arg("verify")
+ .args(["--signer-cert", &artifact("keys/dennis-simon-anton.pgp")])
+ .arg(&*sig.to_string_lossy())
+ .assert()
+ .success();
}
#[test]
@@ -83,18 +81,17 @@ fn sq_sign_with_notations() {
let sig = tmp_dir.path().join("sig0");
// Sign message.
- Assert::cargo_binary("sq")
- .with_args(
- &["sign",
- "--signer-key",
- &artifact("keys/dennis-simon-anton-private.pgp"),
- "--output",
- &sig.to_string_lossy(),
- "--notation", "foo", "bar",
- "--notation", "!foo", "xyzzy",
- "--notation", "hello@example.org", "1234567890",
- &artifact("messages/a-cypherpunks-manifesto.txt")])
- .unwrap();
+ Command::cargo_bin("sq")
+ .unwrap()
+ .arg("sign")
+ .args(["--signer-key", &artifact("keys/dennis-simon-anton-private.pgp")])
+ .args(["--output", &sig.to_string_lossy()])
+ .args(["--notation", "foo", "bar"])
+ .args(["--notation", "!foo", "xyzzy"])
+ .args(["--notation", "hello@example.org", "1234567890"])
+ .arg(&artifact("messages/a-cypherpunks-manifesto.txt"))
+ .assert()
+ .success();
// Check that the content is sane.
let packets: Vec<Packet> =
@@ -146,14 +143,14 @@ fn sq_sign_with_notations() {
assert!(&content[..].starts_with(b"-----BEGIN PGP MESSAGE-----\n\n"));
// Verify signed message.
- Assert::cargo_binary("sq")
- .with_args(
- &["--known-notation", "foo",
- "verify",
- "--signer-cert",
- &artifact("keys/dennis-simon-anton.pgp"),
- &sig.to_string_lossy()])
- .unwrap();
+ Command::cargo_bin("sq")
+ .unwrap()
+ .args(["--known-notation", "foo"])
+ .arg("verify")
+ .args(["--signer-cert", &artifact("keys/dennis-simon-anton.pgp")])
+ .arg(&*sig.to_string_lossy())
+ .assert()
+ .success();
}
#[test]
@@ -162,15 +159,14 @@ fn sq_sign_append() {
let sig0 = tmp_dir.path().join("sig0");
// Sign message.
- Assert::cargo_binary("sq")
- .with_args(
- &["sign",
- "--signer-key",
- &artifact("keys/dennis-simon-anton-private.pgp"),
- "--output",
- &sig0.to_string_lossy(),
- &artifact("messages/a-cypherpunks-manifesto.txt")])
- .unwrap();
+ Command::cargo_bin("sq")
+ .unwrap()
+ .arg("sign")
+ .args(["--signer-key", &artifact("keys/dennis-simon-anton-private.pgp")])
+ .args(["--output", &sig0.to_string_lossy()])
+ .arg(&artifact("messages/a-cypherpunks-manifesto.txt"))
+ .assert()
+ .success();
// Check that the content is sane.
let packets: Vec<Packet> =
@@ -197,26 +193,26 @@ fn sq_sign_append() {
assert!(&content[..].starts_with(b"-----BEGIN PGP MESSAGE-----\n\n"));
// Verify signed message.
- Assert::cargo_binary("sq")
- .with_args(
- &["verify",
- "--signer-cert",
- &artifact("keys/dennis-simon-anton.pgp"),
- &sig0.to_string_lossy()])
- .unwrap();
+ Command::cargo_bin("sq")
+ .unwrap()
+ .arg("verify")
+ .args(["--signer-cert", &artifact("keys/dennis-simon-anton.pgp")])
+ .arg(&*sig0.to_string_lossy())
+ .assert()
+ .success();
// Now add a second signature with --append.
let sig1 = tmp_dir.path().join("sig1");
- Assert::cargo_binary("sq")
- .with_args(
- &["sign",
- "--append",
- "--signer-key",
- &artifact("keys/erika-corinna-daniela-simone-antonia-nistp256-private.pgp"),
- "--output",
- &sig1.to_string_lossy(),
- &sig0.to_string_lossy()])
- .unwrap();
+ Command::cargo_bin("sq")
+ .unwrap()
+ .arg("sign")
+ .arg("--append")
+ .args(["--signer-key", &artifact("keys/erika-corinna-daniela-simone-antonia-nistp256-private.pgp")])
+ .arg("--output")
+ .arg(&*sig1.to_string_lossy())
+ .arg(&*sig0.to_string_lossy())
+ .assert()
+ .success();
// Check that the content is sane.
let packets: Vec<Packet> =
@@ -256,20 +252,20 @@ fn sq_sign_append() {
assert!(&content[..].starts_with(b"-----BEGIN PGP MESSAGE-----\n\n"));
// Verify both signatures of the signed message.
- Assert::cargo_binary("sq")
- .with_args(
- &["verify",
- "--signer-cert",
- &artifact("keys/dennis-simon-anton.pgp"),
- &sig1.to_string_lossy()])
- .unwrap();
- Assert::cargo_binary("sq")
- .with_args(
- &["verify",
- "--signer-cert",
- &artifact("keys/erika-corinna-daniela-simone-antonia-nistp256.pgp"),
- &sig1.to_string_lossy()])
- .unwrap();
+ Command::cargo_bin("sq")
+ .unwrap()
+ .arg("verify")
+ .args(["--signer-cert", &artifact("keys/dennis-simon-anton.pgp")])
+ .arg(&*sig1.to_string_lossy())
+ .assert()
+ .success();
+ Command::cargo_bin("sq")
+ .unwrap()
+ .arg("verify")
+ .args(["--signer-cert", &artifact("keys/erika-corinna-daniela-simone-antonia-nistp256.pgp")])
+ .arg(&*sig1.to_string_lossy())
+ .assert()
+ .success();
}
#[test]
@@ -324,27 +320,26 @@ fn sq_sign_append_on_compress_then_sign() {
}
// Verify signed message.
- Assert::cargo_binary("sq")
- .with_args(
- &["verify",
- "--signer-cert",
- &artifact("keys/dennis-simon-anton.pgp"),
- &sig0.to_string_lossy()])
- .unwrap();
+ Command::cargo_bin("sq")
+ .unwrap()
+ .arg("verify")
+ .args(["--signer-cert", &artifact("keys/dennis-simon-anton.pgp")])
+ .arg(&*sig0.to_string_lossy())
+ .assert()
+ .success();
// Now add a second signature with --append.
let sig1 = tmp_dir.path().join("sig1");
- Assert::cargo_binary("sq")
- .with_args(
- &["sign",
- "--append",
- "--signer-key",
- &artifact("keys/erika-corinna-daniela-simone-antonia-nistp256-private.pgp"),
- "--output",
- &sig1.to_string_lossy(),
- &sig0.to_string_lossy()])
- .fails() // XXX: Currently, this is not implemented.
- .unwrap();
+ Command::cargo_bin("sq")
+ .unwrap()
+ .arg("sign")
+ .arg("--append")
+ .args(["--signer-key", &artifact("keys/erika-corinna-daniela-simone-antonia-nistp256-private.pgp")])
+ .arg("--output")
+ .arg(&*sig1.to_string_lossy())
+ .arg(&*sig0.to_string_lossy())
+ .assert()
+ .failure(); // XXX: Currently, this is not implemented.
// XXX: Currently, this is not implemented in sq.
return;
@@ -387,20 +382,21 @@ fn sq_sign_append_on_compress_then_sign() {
assert!(&content[..].starts_with(b"-----BEGIN PGP MESSAGE-----\n\n"));
// Verify both signatures of the signed message.
- Assert::cargo_binary("sq")
- .with_args(
- &["verify",
- "--signer-cert",
- &artifact("keys/dennis-simon-anton.pgp"),
- &sig0.to_string_lossy()])
- .unwrap();
- Assert::cargo_binary("sq")
- .with_args(
- &["verify",
- "--signer-cert",
- &artifact("keys/erika-corinna-daniela-simone-antonia-nistp256.pgp"),
- &sig0.to_string_lossy()])
- .unwrap();
+ Command::cargo_bin("sq")
+ .unwrap()
+ .arg("verify")
+ .args(["--si