@@ -290,40 +290,45 @@ async def test_head_workaround(self, aiohttp_fixed_head_bug):
290290
291291
292292@pytest .mark .asyncio
293- async def test_ssl_assert_fingerprint (httpbin_cert_fingerprint ):
293+ async def test_ssl_assert_fingerprint (cert_fingerprint ):
294+ print ('***' , cert_fingerprint )
294295 with warnings .catch_warnings (record = True ) as w :
295296 node = AiohttpHttpNode (
296297 NodeConfig (
297298 scheme = "https" ,
298- host = "httpbin.org " ,
299+ host = "www.elastic.co " ,
299300 port = 443 ,
300- ssl_assert_fingerprint = httpbin_cert_fingerprint ,
301+ ssl_assert_fingerprint = cert_fingerprint ,
301302 )
302303 )
303304 resp , _ = await node .perform_request ("GET" , "/" )
304305
305- assert resp .status == 200
306+ assert resp .status == 401
306307 assert [str (x .message ) for x in w if x .category != DeprecationWarning ] == []
307308
308309
309310@pytest .mark .asyncio
310311async def test_default_headers ():
311- node = AiohttpHttpNode (NodeConfig (scheme = "https " , host = "httpbin.org " , port = 443 ))
312+ node = AiohttpHttpNode (NodeConfig (scheme = "http " , host = "localhost " , port = 8080 ))
312313 resp , data = await node .perform_request ("GET" , "/anything" )
313314
314315 assert resp .status == 200
315316 headers = json .loads (data )["headers" ]
316317 headers .pop ("X-Amzn-Trace-Id" , None )
317- assert headers == {"Host" : "httpbin.org" , "User-Agent" : DEFAULT_USER_AGENT }
318+ assert headers == {
319+ "Connection" : "keep-alive" ,
320+ "Host" : "localhost:8080" ,
321+ "User-Agent" : DEFAULT_USER_AGENT ,
322+ }
318323
319324
320325@pytest .mark .asyncio
321326async def test_custom_headers ():
322327 node = AiohttpHttpNode (
323328 NodeConfig (
324- scheme = "https " ,
325- host = "httpbin.org " ,
326- port = 443 ,
329+ scheme = "http " ,
330+ host = "localhost " ,
331+ port = 8080 ,
327332 headers = {"accept-encoding" : "gzip" , "Content-Type" : "application/json" },
328333 )
329334 )
@@ -341,8 +346,9 @@ async def test_custom_headers():
341346 headers .pop ("X-Amzn-Trace-Id" , None )
342347 assert headers == {
343348 "Accept-Encoding" : "gzip" ,
349+ "Connection" : "keep-alive" ,
344350 "Content-Type" : "application/x-ndjson" ,
345- "Host" : "httpbin.org " ,
351+ "Host" : "localhost:8080 " ,
346352 "User-Agent" : "custom-agent/1.2.3" ,
347353 }
348354
@@ -351,9 +357,9 @@ async def test_custom_headers():
351357async def test_custom_user_agent ():
352358 node = AiohttpHttpNode (
353359 NodeConfig (
354- scheme = "https " ,
355- host = "httpbin.org " ,
356- port = 443 ,
360+ scheme = "http " ,
361+ host = "localhost " ,
362+ port = 8080 ,
357363 headers = {
358364 "accept-encoding" : "gzip" ,
359365 "Content-Type" : "application/json" ,
@@ -371,8 +377,9 @@ async def test_custom_user_agent():
371377 headers .pop ("X-Amzn-Trace-Id" , None )
372378 assert headers == {
373379 "Accept-Encoding" : "gzip" ,
380+ "Connection" : "keep-alive" ,
374381 "Content-Type" : "application/json" ,
375- "Host" : "httpbin.org " ,
382+ "Host" : "localhost:8080 " ,
376383 "User-Agent" : "custom-agent/1.2.3" ,
377384 }
378385
@@ -385,7 +392,7 @@ def test_repr():
385392@pytest .mark .asyncio
386393async def test_head ():
387394 node = AiohttpHttpNode (
388- NodeConfig (scheme = "https " , host = "httpbin.org " , port = 443 , http_compress = True )
395+ NodeConfig (scheme = "http " , host = "localhost " , port = 8080 , http_compress = True )
389396 )
390397 resp , data = await node .perform_request ("HEAD" , "/anything" )
391398
0 commit comments