Skip to content

Commit c16ef0a

Browse files
authored
PYTHON-5414 Add test for hostname verification error message regression (#2385)
1 parent e51ac1f commit c16ef0a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

test/asynchronous/test_ssl.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ async def test_cert_ssl_validation_hostname_matching(self):
323323

324324
response = await self.client.admin.command(HelloCompat.LEGACY_CMD)
325325

326-
with self.assertRaises(ConnectionFailure):
326+
with self.assertRaises(ConnectionFailure) as cm:
327327
await connected(
328328
self.simple_client(
329329
"server",
@@ -335,6 +335,8 @@ async def test_cert_ssl_validation_hostname_matching(self):
335335
**self.credentials, # type: ignore[arg-type]
336336
)
337337
)
338+
# PYTHON-5414 Check for "module service_identity has no attribute SICertificateError"
339+
self.assertNotIn("has no attribute", str(cm.exception))
338340

339341
await connected(
340342
self.simple_client(

test/test_ssl.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ def test_cert_ssl_validation_hostname_matching(self):
323323

324324
response = self.client.admin.command(HelloCompat.LEGACY_CMD)
325325

326-
with self.assertRaises(ConnectionFailure):
326+
with self.assertRaises(ConnectionFailure) as cm:
327327
connected(
328328
self.simple_client(
329329
"server",
@@ -335,6 +335,8 @@ def test_cert_ssl_validation_hostname_matching(self):
335335
**self.credentials, # type: ignore[arg-type]
336336
)
337337
)
338+
# PYTHON-5414 Check for "module service_identity has no attribute SICertificateError"
339+
self.assertNotIn("has no attribute", str(cm.exception))
338340

339341
connected(
340342
self.simple_client(

0 commit comments

Comments
 (0)