2727
2828
2929@pytest .mark .asyncio
30- async def test_simple_request (httpbin_node_config ):
30+ async def test_simple_request (httpbin_node_config , httpbin ):
3131 t = AsyncTransport ([httpbin_node_config ])
3232
3333 resp , data = await t .perform_request (
@@ -38,7 +38,7 @@ async def test_simple_request(httpbin_node_config):
3838 )
3939 assert resp .status == 200
4040 assert data ["method" ] == "GET"
41- assert data ["url" ] == "https:// httpbin.org /anything?key[]=1&key[]=2&q1&q2="
41+ assert data ["url" ] == f" { httpbin .url } /anything?key[]=1&key[]=2&q1&q2="
4242
4343 # httpbin makes no-value query params into ''
4444 assert data ["args" ] == {
@@ -53,13 +53,14 @@ async def test_simple_request(httpbin_node_config):
5353 "Content-Type" : "application/json" ,
5454 "Content-Length" : "15" ,
5555 "Custom" : "headeR" ,
56- "Host" : "httpbin.org" ,
56+ "Connection" : "keep-alive" ,
57+ "Host" : f"{ httpbin .host } :{ httpbin .port } " ,
5758 }
5859 assert all (v == data ["headers" ][k ] for k , v in request_headers .items ())
5960
6061
6162@pytest .mark .asyncio
62- async def test_node (httpbin_node_config ):
63+ async def test_node (httpbin_node_config , httpbin ):
6364 def new_node (** kwargs ):
6465 return AiohttpHttpNode (dataclasses .replace (httpbin_node_config , ** kwargs ))
6566
@@ -69,11 +70,12 @@ def new_node(**kwargs):
6970 parsed = parse_httpbin (data )
7071 assert parsed == {
7172 "headers" : {
72- "Host" : "httpbin.org" ,
73+ "Connection" : "keep-alive" ,
74+ "Host" : f"{ httpbin .host } :{ httpbin .port } " ,
7375 "User-Agent" : DEFAULT_USER_AGENT ,
7476 },
7577 "method" : "GET" ,
76- "url" : "https:// httpbin.org /anything" ,
78+ "url" : f" { httpbin .url } /anything" ,
7779 }
7880
7981 node = new_node (http_compress = True )
@@ -83,11 +85,12 @@ def new_node(**kwargs):
8385 assert parsed == {
8486 "headers" : {
8587 "Accept-Encoding" : "gzip" ,
86- "Host" : "httpbin.org" ,
88+ "Connection" : "keep-alive" ,
89+ "Host" : f"{ httpbin .host } :{ httpbin .port } " ,
8790 "User-Agent" : DEFAULT_USER_AGENT ,
8891 },
8992 "method" : "GET" ,
90- "url" : "https:// httpbin.org /anything" ,
93+ "url" : f" { httpbin .url } /anything" ,
9194 }
9295
9396 resp , data = await node .perform_request ("GET" , "/anything" , body = b"hello, world!" )
@@ -99,11 +102,12 @@ def new_node(**kwargs):
99102 "Content-Encoding" : "gzip" ,
100103 "Content-Type" : "application/octet-stream" ,
101104 "Content-Length" : "33" ,
102- "Host" : "httpbin.org" ,
105+ "Connection" : "keep-alive" ,
106+ "Host" : f"{ httpbin .host } :{ httpbin .port } " ,
103107 "User-Agent" : DEFAULT_USER_AGENT ,
104108 },
105109 "method" : "GET" ,
106- "url" : "https:// httpbin.org /anything" ,
110+ "url" : f" { httpbin .url } /anything" ,
107111 }
108112
109113 resp , data = await node .perform_request (
@@ -120,9 +124,10 @@ def new_node(**kwargs):
120124 "Content-Encoding" : "gzip" ,
121125 "Content-Length" : "36" ,
122126 "Content-Type" : "application/json" ,
123- "Host" : "httpbin.org" ,
127+ "Connection" : "keep-alive" ,
128+ "Host" : f"{ httpbin .host } :{ httpbin .port } " ,
124129 "User-Agent" : DEFAULT_USER_AGENT ,
125130 },
126131 "method" : "POST" ,
127- "url" : "https:// httpbin.org /anything" ,
132+ "url" : f" { httpbin .url } /anything" ,
128133 }
0 commit comments