@@ -53,13 +53,13 @@ def assert_host_blocked(result, host):
5353
5454
5555@pytest .fixture
56- def assert_connect (httpbin , pytester ):
56+ def assert_connect (httpserver , pytester ):
5757 def assert_socket_connect (should_pass , ** kwargs ):
5858 # get the name of the calling function
5959 test_name = inspect .stack ()[1 ][3 ]
6060
6161 mark = ""
62- host = kwargs .get ("host" , httpbin .host )
62+ host = kwargs .get ("host" , httpserver .host )
6363 cli_arg = kwargs .get ("cli_arg" , None )
6464 code_template = kwargs .get ("code_template" , connect_code_template )
6565 mark_arg = kwargs .get ("mark_arg" , None )
@@ -70,7 +70,7 @@ def assert_socket_connect(should_pass, **kwargs):
7070 elif isinstance (mark_arg , list ):
7171 hosts = '","' .join (mark_arg )
7272 mark = f'@pytest.mark.allow_hosts(["{ hosts } "])'
73- code = code_template .format (host , httpbin .port , test_name , mark )
73+ code = code_template .format (host , httpserver .port , test_name , mark )
7474 pytester .makepyfile (code )
7575
7676 if cli_arg :
@@ -253,62 +253,62 @@ def test_global_restrict_via_config_fail():
253253 assert_host_blocked (result , "127.0.0.1" )
254254
255255
256- def test_global_restrict_via_config_pass (pytester , httpbin ):
256+ def test_global_restrict_via_config_pass (pytester , httpserver ):
257257 pytester .makepyfile (f"""
258258 import socket
259259
260260 def test_global_restrict_via_config_pass():
261- socket.socket().connect(('{ httpbin .host } ', { httpbin .port } ))
261+ socket.socket().connect(('{ httpserver .host } ', { httpserver .port } ))
262262 """ )
263263 pytester .makeini (f"""
264264 [pytest]
265- addopts = --allow-hosts={ httpbin .host }
265+ addopts = --allow-hosts={ httpserver .host }
266266 """ )
267267 result = pytester .runpytest ()
268268 result .assert_outcomes (passed = 1 )
269269
270270
271- def test_test_isolation (pytester , httpbin ):
271+ def test_test_isolation (pytester , httpserver ):
272272 pytester .makepyfile (f"""
273273 import pytest
274274 import socket
275275
276- @pytest.mark.allow_hosts('{ httpbin .host } ')
276+ @pytest.mark.allow_hosts('{ httpserver .host } ')
277277 def test_pass():
278- socket.socket().connect(('{ httpbin .host } ', { httpbin .port } ))
278+ socket.socket().connect(('{ httpserver .host } ', { httpserver .port } ))
279279
280280 @pytest.mark.allow_hosts('2.2.2.2')
281281 def test_fail():
282- socket.socket().connect(('{ httpbin .host } ', { httpbin .port } ))
282+ socket.socket().connect(('{ httpserver .host } ', { httpserver .port } ))
283283
284284 def test_pass_2():
285- socket.socket().connect(('{ httpbin .host } ', { httpbin .port } ))
285+ socket.socket().connect(('{ httpserver .host } ', { httpserver .port } ))
286286 """ )
287287 result = pytester .runpytest ()
288288 result .assert_outcomes (passed = 2 , failed = 1 )
289- assert_host_blocked (result , httpbin .host )
289+ assert_host_blocked (result , httpserver .host )
290290
291291
292- def test_conflicting_cli_vs_marks (pytester , httpbin ):
292+ def test_conflicting_cli_vs_marks (pytester , httpserver ):
293293 pytester .makepyfile (f"""
294294 import pytest
295295 import socket
296296
297- @pytest.mark.allow_hosts('{ httpbin .host } ')
297+ @pytest.mark.allow_hosts('{ httpserver .host } ')
298298 def test_pass():
299- socket.socket().connect(('{ httpbin .host } ', { httpbin .port } ))
299+ socket.socket().connect(('{ httpserver .host } ', { httpserver .port } ))
300300
301301 @pytest.mark.allow_hosts('2.2.2.2')
302302 def test_fail():
303- socket.socket().connect(('{ httpbin .host } ', { httpbin .port } ))
303+ socket.socket().connect(('{ httpserver .host } ', { httpserver .port } ))
304304
305305 def test_fail_2():
306- socket.socket().connect(('2.2.2.2', { httpbin .port } ))
306+ socket.socket().connect(('2.2.2.2', { httpserver .port } ))
307307 """ )
308308 result = pytester .runpytest ("--allow-hosts=1.2.3.4" )
309309 result .assert_outcomes (passed = 1 , failed = 2 )
310310 assert_host_blocked (result , "2.2.2.2" )
311- assert_host_blocked (result , httpbin .host )
311+ assert_host_blocked (result , httpserver .host )
312312
313313
314314def test_normalize_allowed_hosts (getaddrinfo_hosts ):
0 commit comments