aboutsummaryrefslogtreecommitdiff
path: root/openssl/src/ssl/tests.rs
diff options
context:
space:
mode:
authorPaul Kehrer <[email protected]>2015-02-23 19:39:23 -0600
committerPaul Kehrer <[email protected]>2015-02-23 19:39:23 -0600
commit8940bd767b908e886dc8ef83ca59e5e5f844a06e (patch)
tree38c42f141900033fabcc2d3988010cbccf8e6860 /openssl/src/ssl/tests.rs
parentadd support for SSL_CTX_set_options and SSL_CTX_get_options (diff)
downloadrust-openssl-8940bd767b908e886dc8ef83ca59e5e5f844a06e.tar.xz
rust-openssl-8940bd767b908e886dc8ef83ca59e5e5f844a06e.zip
add support for SSL_CTX_clear_options and use bitflags
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]