aboutsummaryrefslogtreecommitdiff
path: root/openssl/src
diff options
context:
space:
mode:
authorDavid Weinstein <[email protected]>2016-08-16 22:50:20 -0400
committerDavid Weinstein <[email protected]>2016-08-17 01:23:54 -0400
commit8fa4059b82545740440d9e6c796b644327b83c2e (patch)
tree470085518c126f0d821a1974d78fb32199059e14 /openssl/src
parentAdd `"x509_expiry"` feature flag (diff)
downloadrust-openssl-8fa4059b82545740440d9e6c796b644327b83c2e.tar.xz
rust-openssl-8fa4059b82545740440d9e6c796b644327b83c2e.zip
Add test for `"x509_validity"` feature
Diffstat (limited to 'openssl/src')
-rw-r--r--openssl/src/x509/tests.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/openssl/src/x509/tests.rs b/openssl/src/x509/tests.rs
index 43add896..eac08941 100644
--- a/openssl/src/x509/tests.rs
+++ b/openssl/src/x509/tests.rs
@@ -93,6 +93,18 @@ fn test_cert_loading() {
}
#[test]
+#[cfg(feature = "x509_expiry")]
+fn test_cert_issue_validity() {
+ let cert = include_bytes!("../../test/cert.pem");
+ let cert = X509::from_pem(cert).ok().expect("Failed to load PEM");
+ let not_before = cert.not_before().to_string();
+ let not_after = cert.not_after().to_string();
+
+ assert_eq!(not_before, "Aug 14 17:00:03 2016 GMT");
+ assert_eq!(not_after, "Aug 12 17:00:03 2026 GMT");
+}
+
+#[test]
fn test_save_der() {
let cert = include_bytes!("../../test/cert.pem");
let cert = X509::from_pem(cert).ok().expect("Failed to load PEM");