summaryrefslogtreecommitdiffstats
path: root/sqv/tests/not-before-after.rs
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2018-11-26 17:24:47 +0100
committerJustus Winter <justus@sequoia-pgp.org>2018-11-26 19:50:41 +0100
commit02e61f0758e93b44a054a01b4137ea25ff7dd5ec (patch)
treeb1ef6b097e5fc93faf20433219565bbabfa04fb5 /sqv/tests/not-before-after.rs
parent557aca35bad457622642308c1d780757b174bf50 (diff)
sqv: Move sqv into a new crate.
- This allows us to use sequoia-openpgp without compression support reducing binary size and trusted computing base.
Diffstat (limited to 'sqv/tests/not-before-after.rs')
-rw-r--r--sqv/tests/not-before-after.rs62
1 files changed, 62 insertions, 0 deletions
diff --git a/sqv/tests/not-before-after.rs b/sqv/tests/not-before-after.rs
new file mode 100644
index 00000000..5be41bf0
--- /dev/null
+++ b/sqv/tests/not-before-after.rs
@@ -0,0 +1,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(
+ &["-r",
+ &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(
+ &["-r",
+ &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(
+ &["-r",
+ &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(
+ &["-r",
+ &p("keys/emmelie-dorothea-dina-samantha-awina-ed25519.pgp"),
+ "--not-after", "2018-08-14",
+ &p("messages/a-cypherpunks-manifesto.txt.ed25519.sig"),
+ &p("messages/a-cypherpunks-manifesto.txt")])
+ .fails()
+ .unwrap();
+ }
+}