9
9
from gql .transport .exceptions import (
10
10
TransportAlreadyConnected ,
11
11
TransportClosed ,
12
+ TransportConnectionFailed ,
12
13
TransportProtocolError ,
13
14
TransportQueryError ,
14
15
TransportServerError ,
@@ -1155,7 +1156,6 @@ async def handler(request):
1155
1156
@pytest .mark .parametrize ("verify_https" , ["explicitely_enabled" , "default" ])
1156
1157
async def test_httpx_query_https_self_cert_fail (ssl_aiohttp_server , verify_https ):
1157
1158
from aiohttp import web
1158
- from httpx import ConnectError
1159
1159
1160
1160
from gql .transport .httpx import HTTPXAsyncTransport
1161
1161
@@ -1177,15 +1177,19 @@ async def handler(request):
1177
1177
1178
1178
transport = HTTPXAsyncTransport (url = url , timeout = 10 , ** extra_args )
1179
1179
1180
- with pytest .raises (ConnectError ) as exc_info :
1181
- async with Client (transport = transport ) as session :
1180
+ query = gql (query1_str )
1182
1181
1183
- query = gql ( query1_str )
1182
+ expected_error = "certificate verify failed: self-signed certificate"
1184
1183
1185
- # Execute query asynchronously
1184
+ with pytest .raises (TransportConnectionFailed ) as exc_info :
1185
+ async with Client (transport = transport ) as session :
1186
1186
await session .execute (query )
1187
1187
1188
- expected_error = "certificate verify failed: self-signed certificate"
1188
+ assert expected_error in str (exc_info .value )
1189
+
1190
+ with pytest .raises (TransportConnectionFailed ) as exc_info :
1191
+ async with Client (transport = transport ) as session :
1192
+ await session .execute_batch ([query ])
1189
1193
1190
1194
assert expected_error in str (exc_info .value )
1191
1195
0 commit comments