From 4334659397f9c49d171b91429bf8bfaf0844bed5 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Tue, 5 Mar 2024 15:02:31 +0000 Subject: [PATCH] fix tests --- tests/async/test_fetch_browser_context.py | 2 +- tests/async/test_har.py | 2 +- tests/async/test_network.py | 2 +- tests/sync/test_fetch_browser_context.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/async/test_fetch_browser_context.py b/tests/async/test_fetch_browser_context.py index 2c515697b..695b140b7 100644 --- a/tests/async/test_fetch_browser_context.py +++ b/tests/async/test_fetch_browser_context.py @@ -55,7 +55,7 @@ async def test_fetch_should_work(context: BrowserContext, server: Server) -> Non async def test_should_throw_on_network_error( context: BrowserContext, server: Server ) -> None: - server.set_route("/test", lambda request: request.transport.loseConnection()) + server.set_route("/test", lambda request: request.loseConnection()) with pytest.raises(Error, match="socket hang up"): await context.request.fetch(server.PREFIX + "/test") diff --git a/tests/async/test_har.py b/tests/async/test_har.py index d039273cc..b7875ea35 100644 --- a/tests/async/test_har.py +++ b/tests/async/test_har.py @@ -760,7 +760,7 @@ async def test_should_ignore_aborted_requests( tmpdir: Path, ) -> None: path = tmpdir / "test.har" - server.set_route("/x", lambda request: request.transport.loseConnection()) + server.set_route("/x", lambda request: request.loseConnection()) context1 = await context_factory() await context1.route_from_har(har=path, update=True) page1 = await context1.new_page() diff --git a/tests/async/test_network.py b/tests/async/test_network.py index 486a98914..458a0a118 100644 --- a/tests/async/test_network.py +++ b/tests/async/test_network.py @@ -633,7 +633,7 @@ async def test_network_events_request_failed( ) -> None: def handle_request(request: TestServerRequest) -> None: request.setHeader("Content-Type", "text/css") - request.transport.loseConnection() + request.loseConnection() server.set_route("/one-style.css", handle_request) diff --git a/tests/sync/test_fetch_browser_context.py b/tests/sync/test_fetch_browser_context.py index 5a8b38769..dd10d5adf 100644 --- a/tests/sync/test_fetch_browser_context.py +++ b/tests/sync/test_fetch_browser_context.py @@ -52,7 +52,7 @@ def test_fetch_should_work(context: BrowserContext, server: Server) -> None: def test_should_throw_on_network_error(context: BrowserContext, server: Server) -> None: - server.set_route("/test", lambda request: request.transport.loseConnection()) + server.set_route("/test", lambda request: request.loseConnection()) with pytest.raises(Error, match="socket hang up"): context.request.fetch(server.PREFIX + "/test")