Skip to content

Commit 03f4ba1

Browse files
committed
fix tests
1 parent ae8ecc4 commit 03f4ba1

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

test/asynchronous/test_ssl.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
from pymongo import AsyncMongoClient, ssl_support
4444
from pymongo.errors import ConfigurationError, ConnectionFailure, OperationFailure
4545
from pymongo.hello import HelloCompat
46-
from pymongo.ssl_support import HAVE_SSL, _ssl, get_ssl_context
46+
from pymongo.ssl_support import HAVE_SSL, _pyssl, _ssl, get_ssl_context
4747
from pymongo.write_concern import WriteConcern
4848

4949
_HAVE_PYOPENSSL = False
@@ -134,7 +134,7 @@ def test_config_ssl(self):
134134

135135
@unittest.skipUnless(_HAVE_PYOPENSSL, "PyOpenSSL is not available.")
136136
def test_use_pyopenssl_when_available(self):
137-
self.assertTrue(_ssl.IS_PYOPENSSL)
137+
self.assertTrue(_pyssl.IS_PYOPENSSL)
138138

139139
@unittest.skipUnless(_HAVE_PYOPENSSL, "Cannot test without PyOpenSSL")
140140
def test_load_trusted_ca_certs(self):
@@ -177,7 +177,7 @@ async def test_tlsCertificateKeyFilePassword(self):
177177
#
178178
# --sslPEMKeyFile=/path/to/pymongo/test/certificates/server.pem
179179
# --sslCAFile=/path/to/pymongo/test/certificates/ca.pem
180-
if not hasattr(ssl, "SSLContext") and not _ssl.IS_PYOPENSSL:
180+
if not hasattr(ssl, "SSLContext") and not _pyssl.IS_PYOPENSSL:
181181
self.assertRaises(
182182
ConfigurationError,
183183
self.simple_client,
@@ -378,7 +378,7 @@ async def test_cert_ssl_validation_hostname_matching(self):
378378
@async_client_context.require_tlsCertificateKeyFile
379379
@ignore_deprecations
380380
async def test_tlsCRLFile_support(self):
381-
if not hasattr(ssl, "VERIFY_CRL_CHECK_LEAF") or _ssl.IS_PYOPENSSL:
381+
if not hasattr(ssl, "VERIFY_CRL_CHECK_LEAF") or _pyssl.IS_PYOPENSSL:
382382
self.assertRaises(
383383
ConfigurationError,
384384
self.simple_client,
@@ -660,7 +660,7 @@ def remove(path):
660660
@async_client_context.require_async
661661
@unittest.skipUnless(_HAVE_PYOPENSSL, "PyOpenSSL is not available.")
662662
@unittest.skipUnless(HAVE_SSL, "The ssl module is not available.")
663-
async def test_pyopenssl_not_ignored_in_async(self):
663+
async def test_pyopenssl_ignored_in_async(self):
664664
client = AsyncMongoClient(
665665
"mongodb://localhost:27017?tls=true&tlsAllowInvalidCertificates=true"
666666
)

test/test_ssl.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
from pymongo import MongoClient, ssl_support
4444
from pymongo.errors import ConfigurationError, ConnectionFailure, OperationFailure
4545
from pymongo.hello import HelloCompat
46-
from pymongo.ssl_support import HAVE_SSL, _ssl, get_ssl_context
46+
from pymongo.ssl_support import HAVE_SSL, _pyssl, _ssl, get_ssl_context
4747
from pymongo.write_concern import WriteConcern
4848

4949
_HAVE_PYOPENSSL = False
@@ -134,7 +134,7 @@ def test_config_ssl(self):
134134

135135
@unittest.skipUnless(_HAVE_PYOPENSSL, "PyOpenSSL is not available.")
136136
def test_use_pyopenssl_when_available(self):
137-
self.assertTrue(_ssl.IS_PYOPENSSL)
137+
self.assertTrue(_pyssl.IS_PYOPENSSL)
138138

139139
@unittest.skipUnless(_HAVE_PYOPENSSL, "Cannot test without PyOpenSSL")
140140
def test_load_trusted_ca_certs(self):
@@ -177,7 +177,7 @@ def test_tlsCertificateKeyFilePassword(self):
177177
#
178178
# --sslPEMKeyFile=/path/to/pymongo/test/certificates/server.pem
179179
# --sslCAFile=/path/to/pymongo/test/certificates/ca.pem
180-
if not hasattr(ssl, "SSLContext") and not _ssl.IS_PYOPENSSL:
180+
if not hasattr(ssl, "SSLContext") and not _pyssl.IS_PYOPENSSL:
181181
self.assertRaises(
182182
ConfigurationError,
183183
self.simple_client,
@@ -378,7 +378,7 @@ def test_cert_ssl_validation_hostname_matching(self):
378378
@client_context.require_tlsCertificateKeyFile
379379
@ignore_deprecations
380380
def test_tlsCRLFile_support(self):
381-
if not hasattr(ssl, "VERIFY_CRL_CHECK_LEAF") or _ssl.IS_PYOPENSSL:
381+
if not hasattr(ssl, "VERIFY_CRL_CHECK_LEAF") or _pyssl.IS_PYOPENSSL:
382382
self.assertRaises(
383383
ConfigurationError,
384384
self.simple_client,
@@ -660,7 +660,7 @@ def remove(path):
660660
@client_context.require_async
661661
@unittest.skipUnless(_HAVE_PYOPENSSL, "PyOpenSSL is not available.")
662662
@unittest.skipUnless(HAVE_SSL, "The ssl module is not available.")
663-
def test_pyopenssl_not_ignored_in_async(self):
663+
def test_pyopenssl_ignored_in_async(self):
664664
client = MongoClient("mongodb://localhost:27017?tls=true&tlsAllowInvalidCertificates=true")
665665
client.admin.command("ping") # command doesn't matter, just needs it to connect
666666
client.close()

0 commit comments

Comments
 (0)