13
13
import shutil
14
14
import ssl
15
15
import stat
16
+ import sys
16
17
import tempfile
17
18
import textwrap
18
19
import unittest
@@ -1340,13 +1341,13 @@ async def verify_fails(sslmode, *, host='localhost', exn_type):
1340
1341
await verify_works ('allow' )
1341
1342
await verify_works ('prefer' )
1342
1343
await verify_fails ('require' ,
1343
- exn_type = ssl .CertificateError )
1344
+ exn_type = ssl .SSLError )
1344
1345
await verify_fails ('verify-ca' ,
1345
- exn_type = ssl .CertificateError )
1346
+ exn_type = ssl .SSLError )
1346
1347
await verify_fails ('verify-ca' , host = '127.0.0.1' ,
1347
- exn_type = ssl .CertificateError )
1348
+ exn_type = ssl .SSLError )
1348
1349
await verify_fails ('verify-full' ,
1349
- exn_type = ssl .CertificateError )
1350
+ exn_type = ssl .SSLError )
1350
1351
1351
1352
async def test_ssl_connection_default_context (self ):
1352
1353
# XXX: uvloop artifact
@@ -1410,6 +1411,9 @@ async def test_executemany_uvloop_ssl_issue_700(self):
1410
1411
finally :
1411
1412
await con .close ()
1412
1413
1414
+ @unittest .skipIf (
1415
+ sys .version_info < (3 , 7 ), "Python < 3.7 doesn't have ssl.TLSVersion"
1416
+ )
1413
1417
async def test_tls_version (self ):
1414
1418
# XXX: uvloop artifact
1415
1419
old_handler = self .loop .get_exception_handler ()
@@ -1420,7 +1424,7 @@ async def test_tls_version(self):
1420
1424
dsn = 'postgresql://ssl_user@localhost/postgres'
1421
1425
'?sslmode=require&ssl_min_protocol_version=TLSv1.3'
1422
1426
)
1423
- with self .assertRaisesRegex (ssl .SSLError , 'protocol version' ):
1427
+ with self .assertRaises (ssl .SSLError ):
1424
1428
await self .connect (
1425
1429
dsn = 'postgresql://ssl_user@localhost/postgres'
1426
1430
'?sslmode=require'
0 commit comments