diff options
author | Matěj Cepl <mcepl@cepl.eu> | 2018-03-05 13:08:43 +0100 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2018-03-05 14:07:01 +0100 |
commit | f8f3969ed6467e5dd9f7c6d4e33dee49f4a00d9f (patch) | |
tree | e417186f09295130c2863a87c2f47247ebb5805d | |
parent | f749f85db5a61ad4ee0a83d9424cc856ef76fcda (diff) | |
download | m2crypto-f8f3969ed6467e5dd9f7c6d4e33dee49f4a00d9f.tar.gz |
Remove all checks of Linux distros.
platform.linux_distribution() has been deprecated for many versions, and
it will be removed in 3.7 (https://bugs.python.org/issue1322).
Also, we actually don’t need it (if we remove one unused SSLv2 test).
Fixes #205
-rw-r--r-- | tests/__init__.py | 7 | ||||
-rw-r--r-- | tests/test_ssl.py | 28 |
2 files changed, 2 insertions, 33 deletions
diff --git a/tests/__init__.py b/tests/__init__.py index 3ce0db5..1d4b26a 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -2,16 +2,9 @@ import logging import os.path import sys -from platform import linux_distribution - if sys.version_info[:2] <= (2, 6): sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(__file__)), 'vendor')) -distro_string = linux_distribution(supported_dists=('redhat', 'fedora', - 'debian'), - full_distribution_name=False)[0] -plat_fedora = distro_string in ['redhat', 'fedora'] -plat_debian = distro_string in ['debian'] logging.basicConfig(format='%(levelname)s:%(funcName)s:%(message)s', level=logging.DEBUG) diff --git a/tests/test_ssl.py b/tests/test_ssl.py index a191c8f..393765b 100644 --- a/tests/test_ssl.py +++ b/tests/test_ssl.py @@ -37,7 +37,6 @@ except ImportError: from M2Crypto import (Err, Rand, SSL, X509, ftpslib, httpslib, m2, m2urllib, m2urllib2, m2xmlrpclib, six, util) -from tests import plat_fedora from tests.fips import fips_mode log = logging.getLogger('test_SSL') @@ -418,30 +417,6 @@ class MiscSSLClientTestCase(BaseSSLClientTestCase): self.stop_server(pid) self.assertIn('s_server -quiet -www', data) - # TLS is required in FIPS mode - @unittest.skipIf(fips_mode, "Can't be run in FIPS mode") - @unittest.skipUnless(hasattr(m2, "sslv2_method"), - "This platform doesn't support SSLv2") - def test_sslv23_weak_crypto(self): - self.args = self.args + ['-ssl2'] - pid = self.start_server(self.args) - try: - ctx = SSL.Context('sslv23', weak_crypto=1) - s = SSL.Connection(ctx) - # SSLv2 ciphers disabled by default in newer OpenSSL - if plat_fedora and m2.OPENSSL_VERSION_NUMBER < 0x10000000: - s.connect(self.srv_addr) - self.assertEqual(s.get_version(), 'SSLv2') - else: - with self.assertRaises(SSL.SSLError): - s.connect(self.srv_addr) - s.close() - except Exception as ex: - print(('Caught exception %s' % ex)) - raise - finally: - self.stop_server(pid) - def test_cipher_mismatch(self): self.args = self.args + ['-cipher', 'AES256-SHA'] pid = self.start_server(self.args) @@ -463,7 +438,8 @@ class MiscSSLClientTestCase(BaseSSLClientTestCase): ctx = SSL.Context() s = SSL.Connection(ctx) s.set_cipher_list('EXP-RC2-MD5') - with six.assertRaisesRegex(self, SSL.SSLError, 'no ciphers available'): + with six.assertRaisesRegex(self, SSL.SSLError, + 'no ciphers available'): s.connect(self.srv_addr) s.close() finally: |