MCPcopy Index your code
hub / github.com/microsoft/playwright-python / test_should_fulfill_json

Function test_should_fulfill_json

tests/async/test_request_fulfill.py:33–43  ·  view source on GitHub ↗
(page: Page, server: Server)

Source from the content-addressed store, hash-verified

31
32
33async def test_should_fulfill_json(page: Page, server: Server) -> None:
34 async def handle(route: Route) -> None:
35 await route.fulfill(status=201, headers={"foo": "bar"}, json={"bar": "baz"})
36
37 await page.route("**/*", handle)
38
39 response = await page.goto(server.EMPTY_PAGE)
40 assert response
41 assert response.status == 201
42 assert response.headers["content-type"] == "application/json"
43 assert await response.json() == {"bar": "baz"}
44
45
46async def test_should_fulfill_json_overriding_existing_response(

Callers

nothing calls this directly

Calls 3

routeMethod · 0.45
gotoMethod · 0.45
jsonMethod · 0.45

Tested by

no test coverage detected