Debian Codegraph @

tests/policy-as-of.rs

raw
1 use std::path;
2
3 use assert_cmd::Command;
4 use predicates::prelude::*;
5
6 #[test]
7 fn sha1_signature() {
8 // Create an empty policy configuration file. We use this
9 // instead of the system-wide policy configuration file,
10 // which might be more strict than what our test vectors
11 // expect.
12 let policy = path::PathBuf::from(env!("CARGO_TARGET_TMPDIR"))
13 .join("empty-policy.toml");
14 std::fs::write(&policy, "").unwrap();
15
16 Command::cargo_bin("sqv").expect("have sqv")
17 .env("SEQUOIA_CRYPTO_POLICY", &policy)
18 .current_dir(path::Path::new("tests").join("data"))
19 .args(&["--keyring",
20 "mrpast.key",
21 "a-cypherpunks-manifesto.txt.sha1.sig",
22 "a-cypherpunks-manifesto.txt"])
23 .assert()
24 .failure();
25
26 Command::cargo_bin("sqv").expect("have sqv")
27 .env("SEQUOIA_CRYPTO_POLICY", &policy)
28 .current_dir(path::Path::new("tests").join("data"))
29 .args(&["--keyring",
30 "mrpast.key",
31 "--policy-as-of", "2008-08-03",
32 "a-cypherpunks-manifesto.txt.sha1.sig",
33 "a-cypherpunks-manifesto.txt"])
34 .assert()
35 .success()
36 .stdout(predicate::eq(
37 b"40A0E8E64DCC61D977DD86D7165F9B3B60351FBC\n" as &[u8]));
38 }