aboutsummaryrefslogtreecommitdiff
path: root/openssl/src/ssl/tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'openssl/src/ssl/tests.rs')
-rw-r--r--openssl/src/ssl/tests.rs19
1 files changed, 15 insertions, 4 deletions
diff --git a/openssl/src/ssl/tests.rs b/openssl/src/ssl/tests.rs
index c5e9c5e9..3a39baff 100644
--- a/openssl/src/ssl/tests.rs
+++ b/openssl/src/ssl/tests.rs
@@ -4,6 +4,7 @@ use std::old_io::{Writer};
use std::thread;
use crypto::hash::Type::{SHA256};
+use ssl;
use ssl::SslMethod::Sslv23;
use ssl::{SslContext, SslStream, VerifyCallback};
use ssl::SslVerifyMode::SslVerifyPeer;
@@ -183,10 +184,20 @@ fn test_get_ctx_options() {
#[test]
fn test_set_ctx_options() {
let mut ctx = SslContext::new(Sslv23).unwrap();
- let start_opts = ctx.get_options();
- let ssl_op_no_sslv3 = 0x02000000;
- let res = ctx.set_options(ssl_op_no_sslv3);
- assert_eq!(res, start_opts | ssl_op_no_sslv3);
+ let opts = ctx.set_options(ssl::SSL_OP_NO_TICKET);
+ assert!(opts.contains(ssl::SSL_OP_NO_TICKET));
+ assert!(!opts.contains(ssl::SSL_OP_CISCO_ANYCONNECT));
+ let more_opts = ctx.set_options(ssl::SSL_OP_CISCO_ANYCONNECT);
+ assert!(more_opts.contains(ssl::SSL_OP_NO_TICKET));
+ assert!(more_opts.contains(ssl::SSL_OP_CISCO_ANYCONNECT));
+}
+
+#[test]
+fn test_clear_ctx_options() {
+ let mut ctx = SslContext::new(Sslv23).unwrap();
+ ctx.set_options(ssl::SSL_OP_ALL);
+ let opts = ctx.clear_options(ssl::SSL_OP_ALL);
+ assert!(!opts.contains(ssl::SSL_OP_ALL));
}
#[test]