1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
extern crate assert_cli;
#[cfg(test)]
mod integration {
use assert_cli::Assert;
fn p(filename: &str) -> String {
format!("../openpgp/tests/data/{}", filename)
}
#[test]
fn unconstrained() {
Assert::cargo_binary("sqv")
.with_args(
&["--keyring",
&p("keys/emmelie-dorothea-dina-samantha-awina-ed25519.pgp"),
&p("messages/a-cypherpunks-manifesto.txt.ed25519.sig"),
&p("messages/a-cypherpunks-manifesto.txt")])
.stdout().is("8E8C 33FA 4626 3379 76D9 7978 069C 0C34 8DD8 2C19")
.unwrap();
}
#[test]
fn in_interval() {
Assert::cargo_binary("sqv")
.with_args(
&["--keyring",
&p("keys/emmelie-dorothea-dina-samantha-awina-ed25519.pgp"),
"--not-before", "2018-08-14",
"--not-after", "2018-08-15",
&p("messages/a-cypherpunks-manifesto.txt.ed25519.sig"),
&p("messages/a-cypherpunks-manifesto.txt")])
.stdout().is("8E8C 33FA 4626 3379 76D9 7978 069C 0C34 8DD8 2C19")
.unwrap();
}
#[test]
fn before() {
Assert::cargo_binary("sqv")
.with_args(
&["--keyring",
&p("keys/emmelie-dorothea-dina-samantha-awina-ed25519.pgp"),
"--not-before", "2018-08-15",
&p("messages/a-cypherpunks-manifesto.txt.ed25519.sig"),
&p("messages/a-cypherpunks-manifesto.txt")])
.fails()
.unwrap();
}
#[test]
fn after() {
Assert::cargo_binary("sqv")
.with_args(
&["--keyring",
&p("keys/emmelie-dorothea-dina-samantha-awina-ed25519.pgp"),
"--not-after", "2018-08-13",
&p("messages/a-cypherpunks-manifesto.txt.ed25519.sig"),
&p("messages/a-cypherpunks-manifesto.txt")])
.fails()
.unwrap();
}
}
|