From 2a39f7f3c80b9c725b586ca96defbe5bad62bf83 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Wed, 2 Jul 2014 22:56:01 -0500 Subject: switch to env variable based static/dynamic switch for windows --- tests/hazmat/bindings/test_openssl.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/hazmat/bindings/test_openssl.py b/tests/hazmat/bindings/test_openssl.py index 58d7602b..84f46b2e 100644 --- a/tests/hazmat/bindings/test_openssl.py +++ b/tests/hazmat/bindings/test_openssl.py @@ -15,7 +15,9 @@ from __future__ import absolute_import, division, print_function import pytest -from cryptography.hazmat.bindings.openssl.binding import Binding +from cryptography.hazmat.bindings.openssl.binding import ( + Binding, _get_windows_libraries +) class TestOpenSSL(object): @@ -137,3 +139,11 @@ class TestOpenSSL(object): 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) + + def test_windows_static_dynamic_libraries(self): + assert len(_get_windows_libraries("static")) == 7 + + assert len(_get_windows_libraries("dynamic")) == 3 + + with pytest.raises(ValueError): + _get_windows_libraries("notvalid") -- cgit v1.2.3 From 9c80e6c8e4b1ae563baffbcbd2918e07f4f709e3 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Thu, 3 Jul 2014 15:49:27 -0500 Subject: improve unit tests for _get_windows_libraries --- tests/hazmat/bindings/test_openssl.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/hazmat/bindings/test_openssl.py b/tests/hazmat/bindings/test_openssl.py index 84f46b2e..4b51ae82 100644 --- a/tests/hazmat/bindings/test_openssl.py +++ b/tests/hazmat/bindings/test_openssl.py @@ -141,9 +141,9 @@ class TestOpenSSL(object): assert b.lib.SSL_OP_ALL == b.lib.SSL_get_mode(ssl) def test_windows_static_dynamic_libraries(self): - assert len(_get_windows_libraries("static")) == 7 + assert "ssleay32mt" in _get_windows_libraries("static") - assert len(_get_windows_libraries("dynamic")) == 3 + assert "ssleay32" in _get_windows_libraries("dynamic") with pytest.raises(ValueError): _get_windows_libraries("notvalid") -- cgit v1.2.3 From 419e67a1d515ec7883a1e31608c1618e226fbffb Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Sat, 5 Jul 2014 11:15:55 -0500 Subject: change env variable name, handle empty string --- tests/hazmat/bindings/test_openssl.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests') diff --git a/tests/hazmat/bindings/test_openssl.py b/tests/hazmat/bindings/test_openssl.py index 4b51ae82..d22c4fd2 100644 --- a/tests/hazmat/bindings/test_openssl.py +++ b/tests/hazmat/bindings/test_openssl.py @@ -143,6 +143,8 @@ class TestOpenSSL(object): def test_windows_static_dynamic_libraries(self): assert "ssleay32mt" in _get_windows_libraries("static") + assert "ssleay32mt" in _get_windows_libraries("") + assert "ssleay32" in _get_windows_libraries("dynamic") with pytest.raises(ValueError): -- cgit v1.2.3