From 51feabbc27821c5acb7f0ceb932d19c0d79f16d1 Mon Sep 17 00:00:00 2001 From: Nate Prewitt Date: Mon, 3 Jul 2017 17:41:53 -0600 Subject: [PATCH] test ssl version check functions as expected in python 2.6 --- tests/test_help.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/test_help.py diff --git a/tests/test_help.py b/tests/test_help.py new file mode 100644 index 00000000..f08fdd97 --- /dev/null +++ b/tests/test_help.py @@ -0,0 +1,21 @@ +# -*- encoding: utf-8 + +import sys + +import pytest + +from requests.help import info + + +@pytest.mark.skipif(sys.version_info[:2] != (2,6), reason="Only run on Python 2.6") +def test_system_ssl_py26(): + """OPENSSL_VERSION_NUMBER isn't provided in Python 2.6, verify we don't + blow up in this case. + """ + assert info()['system_ssl'] == {'version': ''} + + +@pytest.mark.skipif(sys.version_info < (2,7), reason="Only run on Python 2.7+") +def test_system_ssl(): + """Verify we're actually setting system_ssl when it should be available.""" + assert info()['system_ssl']['version'] != ''