diff options
| author | Steven Fackler <[email protected]> | 2014-10-07 11:05:53 -0700 |
|---|---|---|
| committer | Steven Fackler <[email protected]> | 2014-10-07 11:05:53 -0700 |
| commit | de3f1cf57f39582e9391663ccb6a2b0fcd13137c (patch) | |
| tree | 1cb0974cc5cd3fb0e3583de03632b791b23a823c /src/ssl/tests.rs | |
| parent | Merge pull request #71 from vhbit/path-ization (diff) | |
| parent | Fixed incorrect EOF handling in MemBio, added error description (diff) | |
| download | rust-openssl-de3f1cf57f39582e9391663ccb6a2b0fcd13137c.tar.xz rust-openssl-de3f1cf57f39582e9391663ccb6a2b0fcd13137c.zip | |
Merge pull request #67 from vhbit/membio-eof
Fixed incorrect EOF handling in MemBio, added error description
Diffstat (limited to 'src/ssl/tests.rs')
| -rw-r--r-- | src/ssl/tests.rs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/ssl/tests.rs b/src/ssl/tests.rs index 6cc40033..f98352be 100644 --- a/src/ssl/tests.rs +++ b/src/ssl/tests.rs @@ -1,4 +1,4 @@ -use std::io::Writer; +use std::io::{File, Open, Write, Writer}; use std::io::net::tcp::TcpStream; use std::num::FromStrRadix; use std::str; @@ -218,6 +218,22 @@ fn test_cert_gen() { let res = gen.generate(); assert!(res.is_ok()); + + let (cert, pkey) = res.unwrap(); + + #[cfg(unix)] + static NULL_PATH: &'static str = "/dev/null"; + #[cfg(windows)] + static NULL_PATH: &'static str = "nul"; + + let cert_path = Path::new(NULL_PATH); + let mut file = File::open_mode(&cert_path, Open, Write).unwrap(); + assert!(cert.write_pem(&mut file).is_ok()); + + let key_path = Path::new(NULL_PATH); + let mut file = File::open_mode(&key_path, Open, Write).unwrap(); + assert!(pkey.write_pem(&mut file).is_ok()); + // FIXME: check data in result to be correct, needs implementation // of X509 getters } |