Add test for `"x509_validity"` feature
This commit is contained in:
parent
96b1ef829c
commit
8fa4059b82
|
|
@ -92,6 +92,18 @@ fn test_cert_loading() {
|
|||
assert_eq!(fingerprint, hash_vec);
|
||||
}
|
||||
|
||||
#[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");
|
||||
|
|
|
|||
Loading…
Reference in New Issue