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

Function test_should_fulfill_json

tests/sync/test_request_fulfill.py:31–41  ·  view source on GitHub ↗
(page: Page, server: Server)

Source from the content-addressed store, hash-verified

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