File: not-before-after.rs

package info (click to toggle)
rust-sequoia-sqv 1.3.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 592 kB
  • sloc: makefile: 58
file content (74 lines) | stat: -rw-r--r-- 2,342 bytes parent folder | download
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
63
64
65
66
67
68
69
70
71
72
73
74
#[cfg(test)]
mod integration {
    use assert_cmd::Command;
    use predicates::prelude::*;
    use std::path;

    #[test]
    fn unconstrained() {
        Command::cargo_bin("sqv").expect("have sqv")
            .current_dir(path::Path::new("tests").join("data"))
            .args(&[
                "--keyring",
                "emmelie-dorothea-dina-samantha-awina-ed25519.pgp",
                "a-cypherpunks-manifesto.txt.ed25519.sig",
                "a-cypherpunks-manifesto.txt",
            ])
            .assert()
            .success()
            .stdout(predicate::eq(
                b"8E8C33FA4626337976D97978069C0C348DD82C19\n" as &[u8]));
    }

    #[test]
    fn in_interval() {
        Command::cargo_bin("sqv").expect("have sqv")
            .current_dir(path::Path::new("tests").join("data"))
            .args(&[
                "--keyring",
                "emmelie-dorothea-dina-samantha-awina-ed25519.pgp",
                "--not-before",
                "2018-08-14",
                "--not-after",
                "2018-08-15",
                "a-cypherpunks-manifesto.txt.ed25519.sig",
                "a-cypherpunks-manifesto.txt",
            ])
            .assert()
            .success()
            .stdout(predicate::eq(
                b"8E8C33FA4626337976D97978069C0C348DD82C19\n" as &[u8]));
    }

    #[test]
    fn before() {
        Command::cargo_bin("sqv").expect("have sqv")
            .current_dir(path::Path::new("tests").join("data"))
            .args(&[
                "--keyring",
                "emmelie-dorothea-dina-samantha-awina-ed25519.pgp",
                "--not-before",
                "2018-08-15",
                "a-cypherpunks-manifesto.txt.ed25519.sig",
                "a-cypherpunks-manifesto.txt",
            ])
            .assert()
            .failure();
    }

    #[test]
    fn after() {
        Command::cargo_bin("sqv").expect("have sqv")
            .current_dir(path::Path::new("tests").join("data"))
            .args(&[
                "--keyring",
                "emmelie-dorothea-dina-samantha-awina-ed25519.pgp",
                "--not-after",
                "2018-08-13",
                "a-cypherpunks-manifesto.txt.ed25519.sig",
                "a-cypherpunks-manifesto.txt",
            ])
            .assert()
            .failure();
    }
}