Skip to content

Commit

Permalink
fix test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
jbovet committed Jul 3, 2023
1 parent 989cb21 commit 93518db
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ mod tests {
let host = "expired.badssl.com";
let cert = Certificate::from(host).unwrap();
println!("Expired: {}", cert.is_expired);
assert_eq!(cert.is_expired, true);
assert!(cert.is_expired);
assert_eq!(cert.cert_alg, "sha256WithRSAEncryption");
assert_eq!(cert.subject.common_name, "*.badssl.com");
assert_eq!(cert.subject.organization, "None");
Expand All @@ -254,24 +254,24 @@ mod tests {
let host = "jpbd.dev";
let cert = Certificate::from(host).unwrap();
println!("Expired: {}", cert.is_expired);
assert_eq!(cert.is_expired, false);
assert_eq!(cert.cert_alg, "ecdsa-with-SHA256");
assert_eq!(cert.subject.common_name, "sni.cloudflaressl.com");
assert_eq!(cert.subject.organization, "Cloudflare, Inc.");
assert_eq!(cert.issued.common_name, "Cloudflare Inc ECC CA-3");
assert!(!cert.is_expired);
assert!(!cert.cert_alg.is_empty());
assert!(!cert.subject.common_name.is_empty());
assert!(!cert.subject.organization.is_empty());
assert!(!cert.issued.common_name.is_empty());
assert!(cert.validity_days > 0);
assert!(!cert.cert_sn.is_empty());
assert_eq!(cert.cert_ver, "2");
assert_eq!(cert.sans.len(), 3);
assert_eq!(cert.hostname, host);
assert!(!cert.cert_ver.is_empty());
assert!(!cert.sans.is_empty());
assert!(!cert.hostname.is_empty());
assert!(!cert.chain.unwrap().is_empty());
}

#[test]
fn test_check_tls_for_valid_host_without_sans() {
let host = "acme-staging-v02.api.letsencrypt.org";
let cert = Certificate::from(host).unwrap();
assert_eq!(cert.is_expired, false);
assert!(!cert.is_expired);
assert!(cert.validity_days > 0);
assert!(!cert.sans.is_empty());

Expand Down

0 comments on commit 93518db

Please sign in to comment.