aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2014-09-26 12:38:20 -0500
committerPaul Kehrer <paul.l.kehrer@gmail.com>2014-09-26 12:38:20 -0500
commitd07a0021d000732e4ee9a6cf5f14aee392dfc8df (patch)
treecf6251bfee19c694c177bdc5a92c5adc875d38c2 /tests
parent0520a2512d461b100ce1988ad094f76a219528b5 (diff)
downloadcryptography-d07a0021d000732e4ee9a6cf5f14aee392dfc8df.tar.gz
cryptography-d07a0021d000732e4ee9a6cf5f14aee392dfc8df.tar.bz2
cryptography-d07a0021d000732e4ee9a6cf5f14aee392dfc8df.zip
In tests for setting SSL and SSL_CTX options, get current options first
Fixes #1352
Diffstat (limited to 'tests')
-rw-r--r--tests/hazmat/bindings/test_openssl.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/hazmat/bindings/test_openssl.py b/tests/hazmat/bindings/test_openssl.py
index ca6e9ab0..65e31fd8 100644
--- a/tests/hazmat/bindings/test_openssl.py
+++ b/tests/hazmat/bindings/test_openssl.py
@@ -109,9 +109,11 @@ class TestOpenSSL(object):
assert b.lib.SSL_OP_ALL > 0
ctx = b.lib.SSL_CTX_new(b.lib.TLSv1_method())
ctx = b.ffi.gc(ctx, b.lib.SSL_CTX_free)
+ current_options = b.lib.SSL_CTX_get_options(ctx)
resp = b.lib.SSL_CTX_set_options(ctx, b.lib.SSL_OP_ALL)
- assert resp == b.lib.SSL_OP_ALL
- assert b.lib.SSL_OP_ALL == b.lib.SSL_CTX_get_options(ctx)
+ expected_options = current_options | b.lib.SSL_OP_ALL
+ assert resp == expected_options
+ assert b.lib.SSL_CTX_get_options(ctx) == expected_options
def test_ssl_options(self):
# Test that we're properly handling 32-bit unsigned on all platforms.
@@ -121,9 +123,11 @@ class TestOpenSSL(object):
ctx = b.ffi.gc(ctx, b.lib.SSL_CTX_free)
ssl = b.lib.SSL_new(ctx)
ssl = b.ffi.gc(ssl, b.lib.SSL_free)
+ current_options = b.lib.SSL_get_options(ssl)
resp = b.lib.SSL_set_options(ssl, b.lib.SSL_OP_ALL)
- assert resp == b.lib.SSL_OP_ALL
- assert b.lib.SSL_OP_ALL == b.lib.SSL_get_options(ssl)
+ expected_options = current_options | b.lib.SSL_OP_ALL
+ assert resp == expected_options
+ assert b.lib.SSL_get_options(ssl) == expected_options
def test_ssl_mode(self):
# Test that we're properly handling 32-bit unsigned on all platforms.