Debian Codegraph @

tests/not-before-after.rs

raw
1 #[cfg(test)]
2 mod integration {
3 use assert_cmd::Command;
4 use predicates::prelude::*;
5 use std::path;
6
7 #[test]
8 fn unconstrained() {
9 Command::cargo_bin("sqv").expect("have sqv")
10 .current_dir(path::Path::new("tests").join("data"))
11 .args(&[
12 "--keyring",
13 "emmelie-dorothea-dina-samantha-awina-ed25519.pgp",
14 "a-cypherpunks-manifesto.txt.ed25519.sig",
15 "a-cypherpunks-manifesto.txt",
16 ])
17 .assert()
18 .success()
19 .stdout(predicate::eq(
20 b"8E8C33FA4626337976D97978069C0C348DD82C19\n" as &[u8]));
21 }
22
23 #[test]
24 fn in_interval() {
25 Command::cargo_bin("sqv").expect("have sqv")
26 .current_dir(path::Path::new("tests").join("data"))
27 .args(&[
28 "--keyring",
29 "emmelie-dorothea-dina-samantha-awina-ed25519.pgp",
30 "--not-before",
31 "2018-08-14",
32 "--not-after",
33 "2018-08-15",
34 "a-cypherpunks-manifesto.txt.ed25519.sig",
35 "a-cypherpunks-manifesto.txt",
36 ])
37 .assert()
38 .success()
39 .stdout(predicate::eq(
40 b"8E8C33FA4626337976D97978069C0C348DD82C19\n" as &[u8]));
41 }
42
43 #[test]
44 fn before() {
45 Command::cargo_bin("sqv").expect("have sqv")
46 .current_dir(path::Path::new("tests").join("data"))
47 .args(&[
48 "--keyring",
49 "emmelie-dorothea-dina-samantha-awina-ed25519.pgp",
50 "--not-before",
51 "2018-08-15",
52 "a-cypherpunks-manifesto.txt.ed25519.sig",
53 "a-cypherpunks-manifesto.txt",
54 ])
55 .assert()
56 .failure();
57 }
58
59 #[test]
60 fn after() {
61 Command::cargo_bin("sqv").expect("have sqv")
62 .current_dir(path::Path::new("tests").join("data"))
63 .args(&[
64 "--keyring",
65 "emmelie-dorothea-dina-samantha-awina-ed25519.pgp",
66 "--not-after",
67 "2018-08-13",
68 "a-cypherpunks-manifesto.txt.ed25519.sig",
69 "a-cypherpunks-manifesto.txt",
70 ])
71 .assert()
72 .failure();
73 }
74 }