Skip to content

Commit

Permalink
Test for default values before handshake
Browse files Browse the repository at this point in the history
  • Loading branch information
equalsraf committed Mar 15, 2016
1 parent 7d34eee commit fde6fdd
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions telos/tests/test_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ fn test_client() {
let mut c = new_client()
.ca_file("tests/cert.pem")
.connect(tcp, "google.com").unwrap();

// Defaults before the handshake
assert!(c.certificate_issuer().is_empty());
assert!(c.certificate_hash().is_empty());
assert!(c.certificate_subject().is_empty());
assert!(c.version().is_empty());
assert!(c.cipher().is_empty());

c.handshake().unwrap();

let notbefore = c.peer_cert_notbefore().unwrap();
Expand All @@ -25,6 +33,13 @@ fn test_client() {
c.read(&mut buf).unwrap();
println!("{}", String::from_utf8_lossy(&buf));
assert!(buf.starts_with(b"HTTP/1.1 "));

// After the handshake
assert!(!c.certificate_issuer().is_empty());
assert!(!c.certificate_hash().is_empty());
assert!(!c.certificate_subject().is_empty());
assert!(!c.version().is_empty());
assert!(!c.cipher().is_empty());
}


Expand Down

0 comments on commit fde6fdd

Please sign in to comment.