aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2014-09-26 17:07:25 -0400
committerAlex Gaynor <alex.gaynor@gmail.com>2014-09-26 17:07:25 -0400
commitb818818d51f01994d2deeec2af587eb9936795d8 (patch)
treedec9c72911957300325bb06303609caeedd6087d /tests/hazmat
parent58f63ed781b73478ee3fe60ebe1cfdfd85df5186 (diff)
parentdc6b1cfb8ecada044b31402185b5b5b5615c755a (diff)
downloadcryptography-b818818d51f01994d2deeec2af587eb9936795d8.tar.gz
cryptography-b818818d51f01994d2deeec2af587eb9936795d8.tar.bz2
cryptography-b818818d51f01994d2deeec2af587eb9936795d8.zip
Merge pull request #1355 from reaperhulk/fix-1352
when setting SSL and SSL_CTX options in tests get current options first
Diffstat (limited to 'tests/hazmat')
-rw-r--r--tests/hazmat/bindings/test_openssl.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/tests/hazmat/bindings/test_openssl.py b/tests/hazmat/bindings/test_openssl.py
index ca6e9ab0..78da965f 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.
@@ -133,9 +137,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_mode(ssl)
resp = b.lib.SSL_set_mode(ssl, b.lib.SSL_OP_ALL)
- assert resp == b.lib.SSL_OP_ALL
- assert b.lib.SSL_OP_ALL == b.lib.SSL_get_mode(ssl)
+ expected_options = current_options | b.lib.SSL_OP_ALL
+ assert resp == expected_options
+ assert b.lib.SSL_get_mode(ssl) == expected_options
def test_windows_static_dynamic_libraries(self):
assert "ssleay32mt" in _get_windows_libraries("static")